How to Diagnose a Website Redirect Loop
A redirect loop occurs when two or more responses keep sending the browser back to an earlier address. The browser usually stops with a message such as too many redirects. Common patterns alternate between HTTP and HTTPS, www and the root name, or a sign-in page and the page behind it.
- In an anonymous browser session, record the exact starting address and the repeating
Locationvalues in the Network panel. - If HTTP and HTTPS alternate, check how the proxy connects to the origin and how the application recognizes HTTPS. Cloudflare Flexible with an origin that forces HTTPS is one possible cause.
- If the hostnames alternate, compare the CDN rule, web-server rule and application site URL. If a login page repeats, check cookies and authentication redirects separately.
Trace the chain
Use your browser’s Network panel and preserve the log during navigation. Start at the exact failing URL and record the response codes and Location values in order. Try a new browser session to separate current server rules from cached redirects or cookies. Check whether a public page and an authenticated area behave the same way.
Find the settings that disagree
Compare the intended canonical address across the proxy or CDN, the web server and the application. In a reverse proxy setup, the origin needs trusted information about the client’s HTTPS scheme. Misaligned schemes or domain preferences can cause one layer to undo the other’s redirect. Review your provider’s proxy documentation and avoid trusting arbitrary client-supplied forwarding headers.
Recheck the final destination
Change only the rule that disagrees with the intended flow, and retain its previous setting. Verify the root hostname, www if used and an important subpage. The intended route should end at the correct page after a short chain. Confirm authenticated areas still require appropriate access. Clear only caches involved in the change and check new and existing sessions.
For a Cloudflare-proxied site, read CF-Cache-Status separately from the redirect chain. After a targeted correction, verify the intended HTTPS page with normal certificate validation.
Related guides
- How to Diagnose an HTTPS Certificate Warning
- Fix WordPress 404 Errors After a Permalink Change
- How to Troubleshoot 502, 503 and 504 Website Errors
- Website Troubleshooting category
Official references
Ferkesh Hosting. Last reviewed .
Obrigado pela sua opinião!