Resolving ERR_TOO_MANY_REDIRECTS in WordPress Behind Cloudflare SSL, Nginx & Reverse Proxies

Exact root causes and clean fixes for ERR_TOO_MANY_REDIRECTS loops across Cloudflare SSL modes, .htaccess canonical rewrites, and reverse-proxy PHP headers.

Resolving ERR_TOO_MANY_REDIRECTS in WordPress Behind Cloudflare SSL, Nginx & Reverse Proxies
• TECHNICAL ARCHITECTURAL BLUEPRINT • VERIFIED PRODUCTION CODE EOSITE DIGITAL
ARCHITECTURAL EXECUTIVE SUMMARY VERIFIED IN PRODUCTION • 2026/2027

Definitive Engineering Takeaway: Exact root causes and clean fixes for ERR_TOO_MANY_REDIRECTS loops across Cloudflare SSL modes, .htaccess canonical rewrites, and reverse-proxy PHP headers.

Runtime Benchmark PHP 8.3 • WP 6.7+
Core Web Vitals Mobile LCP < 1.2s
Track Record 150+ Builds • 100% JSS
Production Scope Irish Agency • AU QA Audits
• ARCHITECTURAL TAKEAWAYS
  • Production-tested implementation based on real client projects (SkillStack.ie, FloppyFabrics.ie, Aoife Brogan Ballet).
  • Zero-bloat execution: strict attention to DOM depth, Core Web Vitals (sub-1.2s mobile LCP), and clean PHP hooks.
  • Verified code payloads formatted for rapid copy-paste and direct deployment.

ERR_TOO_MANY_REDIRECTS hits almost immediately after switching DNS onto Cloudflare, migrating hosts, or flipping siteurl from HTTP to HTTPS. It happens when two layers disagree about whether the active connection is encrypted or canonical - bouncing browsers endlessly between 301 and 302 responses.

1. The Cloudflare Flexible SSL Loop (Most Frequent Cause)

When Cloudflare SSL/TLS encryption mode is set to Flexible, visitors hit Cloudflare over HTTPS, but Cloudflare connects to your WordPress origin over plain port 80 (HTTP). Your WordPress origin sees HTTP, forces a 301 Redirect to https://, Cloudflare fetches over HTTP again, and the browser aborts cleanly after 20 hops.

  • Clean Solution: Set Cloudflare SSL/TLS mode to Full (Strict) with an Origin Certificate or valid Let’s Encrypt SSL on the host.

2. Reverse Proxy Header Awareness in wp-config.php

Behind Nginx reverse proxies or load balancers terminating TLS upstream, pass forwarded protocol headers cleanly inside wp-config.php above wp-settings.php:

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

3. Canonical Host & Trailing Slash Conflicts

Verify home and siteurl in wp_options match the exact same protocol and www / apex rule configured in Cloudflare Page Rules and .htaccess.

Tools & Migration Safety

Generate conflict-free Apache & Nginx canonical rules inside our 301 Redirect Rule Generator, validate MX/SPF DNS prior to host switches with Email DNS Inspector, or book Zero-Downtime WordPress Migration.

Need a Quick Fix ($49+) or Dedicated WordPress Engineer?

Start with one small task (SMTP, GA4, Local SEO schema, mobile CSS) or tap directly into 100+ Irish builds & 1,000+ AU QA standards at $25-$30/hr.

← Previous Guide Solving 504 Gateway Timeout Errors During WooCommerce Checkout, Bulk Variations & CSV Imports Next Guide → How to Debug & Fix “cURL error 28: Connection timed out” in WordPress REST API & Webhooks