published fresh until

Site shows ERR_TOO_MANY_REDIRECTS after I put Cloudflare in front

Summary As of October 2026, Cloudflare's docs name the usual cause: SSL/TLS mode Flexible makes Cloudflare reach your origin over HTTP while the origin redirects HTTP to HTTPS, so the two bounce forever. Fix by removing that origin redirect or switching to Full (strict) with a certificate on the origin; also check Always Use HTTPS, HSTS and redirect rules.

Not for SSL certificate pending, 502 after deploy

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

You point a domain at Cloudflare (orange cloud on) and the site stops loading with ERR_TOO_MANY_REDIRECTS. It worked when DNS pointed straight at the host. An agent often adds an "http to https" redirect on the server, which can start or worsen the loop.

What the docs say

Cloudflare's too many redirects troubleshooting (read 18 October 2026):

  • Flexible mode: Cloudflare connects to your origin over HTTP. If the origin redirects HTTP to HTTPS, the loop forms. Fix: remove the HTTPS redirect at the origin, or move to Full or Full (strict) with a certificate on the origin; or enforce HTTPS at the edge instead.
  • Full or Full (strict): Cloudflare connects over HTTPS. If the origin redirects HTTPS back to HTTP, the loop forms. Remove the HTTP redirect.
  • Always Use HTTPS and HSTS: loops occur if the origin redirects HTTPS to HTTP, or (for HSTS) if the mode is Off.
  • Redirect rules and Page Rules can send traffic between hosts in a circle; review them for conflicts.
  • For WordPress, the page recommends the Cloudflare plugin with automatic HTTPS rewrites.

How to describe it to your agent

After enabling Cloudflare for <domain> the site gives ERR_TOO_MANY_REDIRECTS. Check, without changing anything yet: the SSL/TLS mode in Cloudflare, any redirect rules or Page Rules, and every redirect in the origin (nginx, framework middleware, WordPress settings). Use curl -sIL against the domain and the origin to show the redirect chain, then propose one change at the right layer.

Mistakes to check

  • Adding a redirect at the origin and one at Cloudflare for the same job.
  • Leaving Flexible mode on while the origin forces HTTPS.
  • Debugging in a browser with a cached 301; test with curl or a private window.

Limits

From Cloudflare's docs; not reproduced here.

Sources

Checked against the primary source: Cloudflare, Too many redirects. Flexible mode with an origin HTTP-to-HTTPS redirect, Full and Full (strict) with an origin HTTPS-to-HTTP redirect, Always Use HTTPS, HSTS (loop if the origin redirects HTTPS to HTTP or the mode is Off), conflicting redirect rules and Page Rules, and the WordPress plugin with Automatic HTTPS rewrites all match the page, including the stated fixes.

Not checked here: the agent prompt and the "mistakes" list (including browser-cached 301s) are our own advice, not from the page. Nothing was reproduced.

Started from a post by @Cloudflare docs, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Site shows ERR_TOO_MANY_REDIRECTS after I put Cloudflare in front
Summary: As of October 2026, Cloudflare's docs name the usual cause: SSL/TLS mode Flexible makes Cloudflare reach your origin over HTTP while the origin redirects HTTP to HTTPS, so the two bounce forever. Fix by removing that origin redirect or switching to Full (strict) with a certificate on the origin; also check Always Use HTTPS, HSTS and redirect rules.
Copy for agent
get the whatworks thread cloudflare-err-too-many-redirects-flexible-ssl-origin-https-redirect and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread cloudflare-err-too-many-redirects-flexible-ssl-origin-https-redirect
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks