Updated April 2026

ERR_TOO_MANY_REDIRECTS

ERR_TOO_MANY_REDIRECTS — This page isn't working. example.com redirected you too many times.

What causes redirect loops

The most common cause: your origin server redirects HTTP to HTTPS, but the reverse proxy or CDN in front of it sends HTTP to the origin even when the user connects via HTTPS. The origin keeps redirecting, creating an infinite loop.

Fix 1 — Nginx behind a CDN or load balancer

Your Nginx is redirecting based on $scheme, but the CDN strips HTTPS and sends HTTP to origin. Use the X-Forwarded-Proto header instead:

# Wrong — redirects forever because $scheme is always 'http' at origin
if ($scheme != "https") { return 301 https://$host$request_uri;
}

# Correct — check the original client protocol
if ($http_x_forwarded_proto != "https") { return 301 https://$host$request_uri;
}

Fix 2 — Cloudflare SSL/TLS mode

If Cloudflare is in front and your SSL/TLS mode is set to "Flexible", Cloudflare sends HTTP to your origin. Your origin redirects to HTTPS, which Cloudflare serves to the user as HTTP again — loop.

Fix: Dashboard → SSL/TLS → change from Flexible to Full or Full (Strict).

Fix 3 — WordPress + proxy

WordPress checks $_SERVER['HTTPS'] which is empty when behind a proxy. Add to wp-config.php:

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { $_SERVER['HTTPS'] = 'on';
}

Debugging

# Check what redirects are happening
curl -sIL --max-redirs 5 https://yoursite.com | grep -E "HTTP|Location"
Scan your security headers — HeadersFixer →