HTTP→HTTPS redirect loop behind a load balancer or reverse proxy (X-Forwarded-Proto)
The app forces HTTPS, but TLS ends at the proxy, so the app always sees HTTP and keeps redirecting.
ERR_TOO_MANY_REDIRECTS behind load balancerredirect loop HTTPS X-Forwarded-Prototoo many redirects behind reverse proxyinfinite redirect http to https proxyredirected you too many times Meaning
The proxy talks plain HTTP to the app and the app redirects every request to https:// forever (ERR_TOO_MANY_REDIRECTS). Make the app trust X-Forwarded-Proto (TRUSTED_PROXIES, app.set("trust proxy"), SECURE_PROXY_SSL_HEADER) and ensure the proxy sets it.
Common causes
- App doesn't trust
X-Forwarded-Proto - Proxy not setting the header
- Cloudflare Flexible SSL with an HTTPS-only origin
force_ssl/$_SERVER['HTTPS']check- Redirect rule in both proxy and app
⚡ Quick fix
- Trust the proxy header in the framework
proxy_set_header X-Forwarded-Proto $scheme;- Use Full (strict) SSL mode at the CDN
Detailed fix by platform
Express
app.set("trust proxy", 1); // so req.protocol uses X-Forwarded-Proto
How to diagnose
- Header — Sent by proxy?
- App — Trusts it?
- SSL mode — Full?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in HTTP
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026