Redirect loop HTTP Origin: Network OSI layer 7 · Application Last updated 18 Nov 2026

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.

Exact message you may see 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
Seen on: HTTP Nginx AWS Laravel

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

  1. Trust the proxy header in the framework
  2. proxy_set_header X-Forwarded-Proto $scheme;
  3. Use Full (strict) SSL mode at the CDN

Detailed fix by platform

Express

  1. app.set("trust proxy", 1); // so req.protocol uses X-Forwarded-Proto

How to diagnose

  1. Header — Sent by proxy?
  2. App — Trusts it?
  3. 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:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

203 — HTTP 203 Non-Authoritative Information (HTTP)203307 — HTTP 307 Temporary Redirect (HTTP)307401 — 401 because the Authorization header is stripped (HTTP)401421 — HTTP 421 Misdirected Request (HTTP)421497 — 400 Bad Request: The plain HTTP request was sent to HTTPS port (Nginx 497) (HTTP)497598 — HTTP 598 Network Read Timeout Error (HTTP)598CERTIFICATE_VERIFY_FAILED — SSL: CERTIFICATE_VERIFY_FAILED / unable to get local issuer certificate (API)CERTIFICATE_VERIFY_FA…ERR_TOO_MANY_REDIRECTS — Chrome: This page isn’t working — example.com redirected you too many times. ERR_TOO_MANY_REDIRECTS (Browser)ERR_TOO_MANY_REDIRECTSRedirect …

Explore the map of this error Full error map →

🧠 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.