Knowledge

ERR_TOO_MANY_REDIRECTS (redirect loop)

#Errors

This error means the browser was bounced between URLs until it gave up. The classic cause is a redirect loop between HTTP and HTTPS, very often a Cloudflare SSL setting fighting your server config.

Published by Mark van Eijk on June 23, 2026 · 1 minute read

  1. About the error
  2. Why do I see this error
  3. Solution
  4. Fix Cloudflare SSL mode
  5. Trust the proxy's protocol header
  6. Check your nginx redirect
  7. Diagnose the loop

About the error

The browser shows ERR_TOO_MANY_REDIRECTS (Chrome) or "The page isn't redirecting properly" (Firefox). It means a URL redirected to another URL that redirected back, forming a loop. After a handful of hops the browser stops to avoid looping forever.

Why do I see this error

The overwhelmingly common cause is an HTTP ↔ HTTPS loop, and the most common trigger of that is Cloudflare's SSL mode set to "Flexible":

  • Cloudflare talks to your server over plain HTTP.
  • Your server (or app) redirects all HTTP to HTTPS.
  • Cloudflare receives that redirect, requests again over HTTP, gets redirected again, forever.

Other causes: an app forcing HTTPS while a proxy already terminates TLS, a misconfigured www ↔ non-www redirect, or two redirect rules pointing at each other.

Solution

Fix Cloudflare SSL mode

If you use Cloudflare, set the SSL/TLS encryption mode to Full or Full (strict), never Flexible. Flexible is the single biggest cause of this loop for sites behind Cloudflare. Full means Cloudflare connects to your origin over HTTPS, which matches your server redirecting to HTTPS. See an A+ grade SSL using Cloudflare.

Trust the proxy's protocol header

When TLS is terminated by a proxy or load balancer, your app sees the request as plain HTTP and redirects to HTTPS, even though the visitor is already on HTTPS. Tell the app to trust the forwarded protocol. In Laravel, configure trusted proxies in bootstrap/app.php:

->withMiddleware(function (Middleware $middleware) {
    $middleware->trustProxies(at: '*', headers:
        Request::HEADER_X_FORWARDED_FOR |
        Request::HEADER_X_FORWARDED_HOST |
        Request::HEADER_X_FORWARDED_PORT |
        Request::HEADER_X_FORWARDED_PROTO
    );
})

Check your nginx redirect

A correct HTTP→HTTPS redirect redirects only plain HTTP, and the HTTPS server block must not redirect again:

server {
    listen 80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name example.com;
    # serve the site here, do NOT redirect to https again
}

Diagnose the loop

Follow the redirect chain from the command line to see exactly where it loops:

curl -sIL https://example.com | grep -i location

If you see the same two URLs alternating, you've found your loop.

Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

Related articles

Error in the HTTP2 framing layer

This error means the browser was bounced between URLs until it gave up. The classic cause is a redirect loop between HTTP and HTTPS, very often a Cloudflare SSL setting fighting your server config.

Read more →

413 Request Entity Too Large in nginx

This error means the browser was bounced between URLs until it gave up. The classic cause is a redirect loop between HTTP and HTTPS, very often a Cloudflare SSL setting fighting your server config.

Read more →