How to Trace an ERR_TOO_MANY_REDIRECTS Loop
ERR_TOO_MANY_REDIRECTS means a page redirects in a circle. Trace it hop by hop with curl, and see the classic proxy and HTTPS loop reproduced and fixed.
ERR_TOO_MANY_REDIRECTS means the page redirected the browser so many times that it gave up, almost always because two rules send it back and forth in a loop (A → B → A). As a visitor, clear the site’s cookies and retry. As the site owner, trace the redirects hop by hop with curl -IL and look for two components (application, proxy, CDN, plugin) that disagree about the correct URL.
Trace it
curl shows each hop. -I asks for headers only, -L follows redirects, and --max-redirs stops the loop:
curl -sIL --max-redirs 10 https://example.com/ | grep -iE '^(HTTP|location)'
A loop shows the same location values repeating. Note whether the scheme (http/https), the host (www or not) or a trailing slash flips back and forth: that tells you which two rules are fighting.
The classic loop, reproduced
The most common cause on modern hosting is HTTPS enforcement behind a proxy. The visitor talks HTTPS to the proxy or CDN, but the proxy talks plain HTTP to the application. The app sees HTTP, redirects to HTTPS, and the cycle repeats. We rebuilt that setup locally: an app on port 9201 that redirects unless the X-Forwarded-Proto header says https, behind a proxy on port 9200 standing in for the HTTPS front door.
$ curl -sS -L --max-redirs 5 -o /dev/null -w "final %{http_code} after %{num_redirects} redirects\n" http://127.0.0.1:9200/
curl: (47) Maximum (5) redirects followed
final 301 after 5 redirects
$ curl -sS -I http://127.0.0.1:9200/
HTTP/1.1 301 Moved Permanently
location: http://127.0.0.1:9200/
The redirect points to the very URL that was requested. The app’s log explains why:
[app] GET / -> 301 (X-Forwarded-Proto is null)
[app] GET / -> 301 (X-Forwarded-Proto is null)
… (one line per hop)
-
browserStep 1. Request the public URL
The visitor requests the site through the proxy (HTTPS in production).
-
proxyStep 2. Proxy forwards without the scheme
The proxy passes the request to the app over plain HTTP and does not set X-Forwarded-Proto: https.
-
appStep 3. App thinks the request is insecure
The app's “force HTTPS” rule sees no https marker and answers 301 to the public HTTPS URL.
-
browserStep 4. Browser follows the redirect
Back to the same public URL, the same proxy, the same missing header, the same 301. Browsers stop after about 20 hops and show ERR_TOO_MANY_REDIRECTS.
-
fixStep 5. Proxy sets the header
With the proxy adding X-Forwarded-Proto: https (and the app trusting it), the app serves the page.
{"page":"home"} final 200 after 0 redirects
After the one-line fix in the proxy the same command returned the page with 0 redirects.
Common loops and their fixes
| Loop | Cause | Fix |
|---|---|---|
| https → http → https | app or CMS forces HTTPS but sees HTTP behind a proxy/CDN | set and trust X-Forwarded-Proto; or CDN SSL mode “full” instead of “flexible” |
| www ↔ non-www | CDN or DNS rule redirects one way, app or CMS redirects the other | pick one canonical host; configure it in exactly one place |
| /page ↔ /page/ | server adds a trailing slash, app removes it | align trailing-slash settings |
| login → page → login | session cookie not saved (blocked, wrong domain, insecure flag on HTTP) | fix cookie domain/Secure flag; clear cookies |
| country/language redirect | geo or language rule redirects to a page that redirects back | exclude the target page from the rule |
For visitors
- Clear cookies for that site (or open a private window). A stale login or preference cookie is the most common visitor-side cause.
- Check the device’s date and time; wrong clocks break cookies and HTTPS.
- Disable extensions that rewrite URLs or force HTTPS, then retry.
If it still fails, the loop is on the server side and only the site can fix it. Certificate problems on the HTTPS side produce different errors; see the ERR_CERT_AUTHORITY_INVALID guide.
Sources
- net_error_list.h (TOO_MANY_REDIRECTS = −310) — Chromium
- RFC 9110: HTTP Semantics, redirection 3xx — IETF
- Fix connection errors — Google Chrome Help
How we made this
Reproduced in a local lab. We ran a Node.js app behind a minimal Node.js reverse proxy on localhost. The app redirects to the public URL unless X-Forwarded-Proto is https; the proxy initially did not set that header. curl -L traces and the app's log are quoted verbatim, before and after the one-line proxy fix.
Performed by Claude, an AI assistant working in the BinConvert repository (macOS, Node.js 25.8.2, curl 8.7.1), November 16, 2026.
This article was drafted with AI assistance. Every example, calculation and command output on this page was re-run or checked before release; the loop and the fix were reproduced again with the same curl output. Review: automated test suite and source check, November 16, 2026.
Spotted an error? Tell us and we will correct it.