What the message looks like
This page isn't working
example.com redirected you too many times.
ERR_TOO_MANY_REDIRECTSCommon causes
- A CDN or proxy talks plain HTTP to your server, while the server redirects every HTTP request to HTTPS (a typical Flexible SSL loop).
- The application builds the redirect from the wrong scheme because the proxy does not pass
X-Forwarded-Proto, so it redirects to HTTPS again and again. - Conflicting www and non-www rules: the server redirects to one, the application or CMS to the other.
- A CMS has
siteurlorhomeset to a different address than the one visitors use. - Stale cookies in a login redirect loop (works in a private window).
Check
- Follow the redirects with the limit and read each Location
curl -sIL --max-redirs 10 https://example.com/ | grep -iE '^(HTTP|location)' - What does plain HTTP do?
curl -sI http://example.com/ | grep -iE '^(HTTP|location)' - Redirect rules in the nginx config
nginx -T 2>/dev/null | grep -nE 'return 30[0-9]|rewrite .*(permanent|redirect)|X-Forwarded-Proto' - Test with the proxy header the app expects
curl -sI -H 'X-Forwarded-Proto: https' http://127.0.0.1/ -H 'Host: example.com' | grep -iE '^(HTTP|location)'
Fix
- Read the Location chain from the first check: the two URLs that alternate show who redirects where.
- With a CDN, set its SSL mode so it connects to your origin over HTTPS (for example Full), not plain HTTP.
- Behind a proxy pass the scheme:
proxy_set_header X-Forwarded-Proto $scheme;, and make the application trust it. - Decide on one canonical host (www or not) and redirect only once, in one place.
- Fix
siteurlandhomeof the CMS, clear the site cookies, and test again.
Typical scenario
You have a WordPress site behind Cloudflare in "Flexible" SSL mode and also an nginx redirect from HTTP to HTTPS on the origin server. Since the change the browser shows ERR_TOO_MANY_REDIRECTS: Cloudflare fetches the origin over HTTP, nginx redirects to HTTPS, Cloudflare fetches over HTTP again. With curl -sIL --max-redirs 5 https://example.com check which two addresses alternate and who sets the Location header each time.
FAQ
Why does it work in a private window?
A cookie, often a session or login cookie, takes part in the loop. Clearing cookies for the site confirms it.
How many redirects does the browser follow?
A limit exists and differs per browser, so do not rely on a number. Any loop eventually ends in this error.
How do I see the loop without a browser?
With curl -sIL --max-redirs 5 https://example.com curl shows every stop in the chain with status code and Location header and gives up after five hops. If the same two URLs repeat, you found the loop. The Server header tells you which layer answers each time.
Why does WordPress cause loops behind a proxy?
WordPress detects HTTPS from the server and redirects when it sees only HTTP. If the request comes from the proxy over HTTP, WordPress keeps redirecting. If passing X-Forwarded-Proto does not help, set $_SERVER['HTTPS'] = 'on' in wp-config.php depending on that header.
What is the difference between Cloudflare "Flexible" and "Full (strict)"?
With "Flexible" Cloudflare encrypts only the leg to the visitor and fetches from the origin unencrypted. "Full" uses HTTPS to the origin, and "Full (strict)" also checks for a valid certificate. With an HTTP-to-HTTPS redirect on the origin, "Flexible" is the typical loop.