Cloudflare Too Many Redirects (ERR_TOO_MANY_REDIRECTS): A Tested Fix for WordPress

Cloudflare too many redirects: the browser's This page isn't working error from my Flexible SSL plus Force HTTPS test.

Cloudflare too many redirects (ERR_TOO_MANY_REDIRECTS in Chrome) means the browser was sent from one address to another until it gave up. On a site behind Cloudflare the usual cause is a mismatch about HTTPS: Cloudflare’s SSL/TLS mode is Flexible, so it talks to your server over plain HTTP, while your server or WordPress keeps sending everyone back to HTTPS.

The fix that lasts is to install a certificate on the server and switch Cloudflare to Full (strict). I caused two different redirect loops on a WordPress test server behind Cloudflare, read them with curl, and fixed both with that one change. Below is what I saw, how to find your cause, and the fix step by step. If you only see this on someone else’s site, jump to the visitor section.

Tested by Dolon Bepari, 20 November 2026

  • Server: a throwaway Ubuntu 22.04 VPS (1 vCPU, about 2 GB RAM), aaPanel 7, Nginx 1.30.7, PHP 8.4, WordPress
  • Cloudflare: Free plan, orange cloud (proxied), test domain filecafe.site, with a Cloudflare Origin CA certificate on the server
  • How I measured: curl and a browser from my PC in Dhaka, Bangladesh, through Cloudflare
  • There are no affiliate links in this guide. How I test: how we review

What ERR_TOO_MANY_REDIRECTS means on a Cloudflare site

A redirect is a 301 or 302 answer that says “go to this other address instead”. A loop is when that chain never ends, for example HTTPS sends you to HTTPS again, or HTTP and HTTPS keep sending you to each other. Browsers stop after a set number of hops and show an error: Chrome and Brave say the site “redirected you too many times” with the code ERR_TOO_MANY_REDIRECTS, and Firefox says “The page isn’t redirecting properly”.

Browser page saying This page isn't working, filecafe.site redirected you too many times, ERR_TOO_MANY_REDIRECTS.
The loop from my lab in Brave: Flexible SSL plus a Force HTTPS redirect on the server.

It is not a Cloudflare 5xx error like error 521 or error 526. Cloudflare and the server both answer normally; they just keep giving the browser a new address. That is why the error page comes from the browser, not from Cloudflare, and why it often appears right after a site is added to Cloudflare or its SSL setting changes.

Visitor or site owner: who has to fix it?

If you are a visitor, first delete the cookies for that one site (or open it in a private window), because a stale login or redirect cookie can cause a loop on your side. The browser page itself suggests this. If the site still loops in a private window and on another device, the problem is on the website, and only its owner can fix it.

If you own the site, clearing cookies will not fix a loop that comes from your settings. The fix is in Cloudflare’s SSL/TLS mode, your server’s redirect rules, or WordPress. The steps below find which one in a few minutes.

How I reproduced the Cloudflare redirect loop (and fixed it)

None of the top-ranking guides I read showed a real Cloudflare redirect loop in curl. I built one on a throwaway VPS that I deleted afterwards: WordPress on aaPanel, a test domain proxied through Cloudflare’s Free plan, and a 7-day Cloudflare Origin CA certificate installed on the server (the same lab as my error 526 test). WordPress’s own address (siteurl and home) already started with https.

Throwaway Ubuntu 22.04 test VPS used for the Cloudflare error lab, with 1 vCPU, about 2 GB RAM and a 25 GB disk.
The test server: Ubuntu 22.04, 1 vCPU, about 2 GB RAM, 25 GB disk (server name blurred).

Loop 1: Flexible SSL and WordPress wp-admin

I set Cloudflare to Flexible (SSL/TLS, Configure, Custom SSL/TLS, Flexible). aaPanel’s Force HTTPS was still off at this point. Then I asked for /wp-admin/ from my PC with curl, following redirects.

Every answer was 302 Found with X-Redirect-By: WordPress and Location: https://filecafe.site/wp-admin/, the same address I had asked for. WordPress was redirecting HTTPS to HTTPS, because over Flexible it received the request as plain HTTP and wanted the admin area on HTTPS. In my notes from the same test, the homepage returned 200 (not in the screenshots); wp-admin was the page that looped.

curl -sSIL output for /wp-admin/ through Cloudflare: repeated 302 Found responses with X-Redirect-By WordPress and the same https wp-admin Location.
Flexible mode: WordPress answers 302 and sends wp-admin back to the same https address, again and again.

Loop 2: Flexible SSL and Force HTTPS on the server

Next I switched on Force HTTPS in aaPanel’s SSL settings for the site, which adds an HTTP-to-HTTPS redirect to the site’s Nginx config. Cloudflare was still on Flexible.

aaPanel SSL settings for the test site with the deployed certificate and Force HTTPS switched on.
aaPanel’s SSL tab with Force HTTPS on (key and certificate text cropped out).

Now even a plain text file looped. Each answer was 301 Moved Permanently pointing to https://filecafe.site/cf-lab.txt, the address I had just requested, with no WordPress header this time: Nginx sent it. The browser showed ERR_TOO_MANY_REDIRECTS (the browser screenshot earlier in this guide).

curl -sSIL output for a test file through Cloudflare: 301 Moved Permanently again and again, each pointing to the same https URL.
Flexible plus Force HTTPS: Nginx answers 301 to the same https URL on every hop.

The fix: Full (strict) gave 200 on the first hop

I changed only Cloudflare’s mode to Full (strict) and left Force HTTPS on. The same curl command got HTTP/1.1 200 OK straight away, with no redirect. In Full (strict), Cloudflare connects to the server on port 443 over HTTPS and checks its certificate, so the server’s “go to HTTPS” rule no longer fires.

curl -sSIL for the test file returning HTTP/1.1 200 OK on the first hop, with no redirects.
Full (strict), Force HTTPS still on: 200 OK on the first request.

What this test does and does not show

It shows the Flexible loop that Cloudflare’s docs list first, in two forms (server and WordPress), and that Full (strict) ended both of them on a server with a valid origin certificate. Every response in my captures also carried a Strict-Transport-Security header (HSTS) for one year. I did not check Cloudflare’s own HSTS setting, so I do not claim which side added it, and I did not test an HSTS loop.

I also tried the “Always Use HTTPS plus a server redirect to HTTP” case, but my capture did not show the expected switching between http and https, so I do not count it as reproduced. That cause and the other untested rows in the table below come from Cloudflare’s redirect loop documentation or from common WordPress setups, not from my tests.

Why Flexible SSL causes a redirect loop

This is the classic Cloudflare Flexible SSL redirect loop. Flexible encrypts only half of the trip. The visitor’s browser talks HTTPS to Cloudflare, but Cloudflare talks plain HTTP to your server on port 80. Your server never sees an HTTPS request, so any rule that says “if this is not HTTPS, redirect to HTTPS” fires every time:

  1. The browser asks Cloudflare for https://example.com/.
  2. Cloudflare forwards it to your server as http://example.com/ (Flexible).
  3. Your server, or WordPress, answers “301/302, go to https://example.com/“.
  4. Cloudflare passes that redirect to the browser, the browser asks for the same HTTPS address again, and step 2 repeats.

That is why the Location in my captures always pointed to the address that was just requested. Cloudflare’s docs give the two ways out: remove the HTTPS redirect from the origin, or move to Full or Full (strict), which needs a certificate on the server. The second one also encrypts the Cloudflare-to-server leg, so it is the one I recommend.

Causes of Cloudflare too many redirects (tested and not tested)

Find the row that matches what curl shows you in the next section.

CauseWhat curl showsFixIn my lab
Flexible + HTTPS redirect on the server (panel Force HTTPS, Nginx or .htaccess rule)301 or 302 to the same https URL, every hopFull (strict) with a certificate, or remove the origin redirectReproduced (301, Nginx)
Flexible + WordPress forcing HTTPS on wp-admin302 to the same https wp-admin URL with X-Redirect-By: WordPressFull (strict), or the wp-config patch belowReproduced (302 on wp-admin)
Full or Full (strict) + server redirects HTTPS to HTTPLocation switches between https and httpRemove the HTTP redirect on the serverNot tested
Always Use HTTPS + server redirects HTTPS to HTTPLocation switches between https and httpRemove the server redirect (or turn Always Use HTTPS off)Tried, not reproduced
HSTS with the server sending visitors to HTTP, or SSL mode set to OffBrowser refuses HTTP; loop or security errorMake HTTPS work on the server; do not switch HSTS off as the fixNot tested
Conflicting Redirect Rules or Page Rules in CloudflareHops between two different URLs, often www and non-wwwDelete or fix one of the rulesNot tested
WordPress address mismatch (www vs non-www in siteurl/home)Hops between www and non-wwwMake siteurl, home and your redirect agreeNot tested
An SSL or redirect plugin (for example Really Simple SSL) fighting the serverMixed, often wp-admin onlyDisable the plugin and test againNot tested

Cloudflare’s own list (redirect loop page, last updated 1 September 2026, checked 21 November 2026) covers the SSL mode, Always Use HTTPS, HSTS and redirect rule rows. The wp-admin row comes from my own test; the www and plugin rows are common WordPress causes that I did not test.

How to find the cause with curl, step by step

Most Cloudflare too many redirects cases can be read from the response headers alone. Every command below says where to run it and what it does. All of them only read; none changes anything. Replace example.com with your domain.

Step 1: Watch the loop in curl

▶ On your own computer, in Windows cmd or PowerShell (type curl.exe, not curl, in PowerShell). On Mac or Linux, use curl instead of curl.exe:

curl.exe -sSIL --max-redirs 5 https://example.com/wp-admin/

What it does: asks for the page through Cloudflare, prints only the response headers (-I), follows redirects (-L) but stops after five (--max-redirs 5), and stays quiet except for errors (-sS). It changes nothing. Run it once for /wp-admin/ and once for /.

Read the Location lines. The same https address every time means Flexible plus an HTTPS redirect (my lab). Add X-Redirect-By: WordPress and the redirect comes from WordPress, not the web server. Locations that switch between http and https, or between www and non-www, point to the other rows in the table above. If curl shows a single 200 but the browser still loops, delete that site’s cookies and test in a private window.

Step 2: Check the SSL/TLS mode in Cloudflare

No command. In the Cloudflare dashboard open your domain, then SSL/TLS, Overview. If it says Flexible and step 1 showed the same https address on every hop, you have found the cause. If Automatic SSL/TLS is on, Cloudflare chooses the mode for you; in my lab I always set it myself with Configure, Custom SSL/TLS.

Step 3: See what your server does with plain HTTP

▶ On the server (SSH terminal):

curl -sSI --resolve example.com:80:127.0.0.1 http://example.com/

What it does: asks the web server on this machine for your homepage over plain HTTP, the way Cloudflare does in Flexible mode, skipping DNS and Cloudflare, and prints the headers. It changes nothing. A 301 or 302 with an https Location means your server forces HTTPS, which loops under Flexible. I did not run this exact command in my lab; the curl captures above showed the same thing from the outside.

Step 4: Find the redirect rule in Nginx or aaPanel

▶ On the server (SSH terminal), as root or with sudo; aaPanel path:

grep -nE "server_port|return 30[12]|rewrite" /www/server/panel/vhost/nginx/example.com.conf

What it does: prints the lines in your site’s Nginx config that check the port or send redirects, with line numbers. It changes nothing. aaPanel’s Force HTTPS adds a block that starts with if ($server_port !~ 443). On a standard Nginx install, look in /etc/nginx/sites-enabled/ or /etc/nginx/conf.d/; on Apache, the redirect is usually in .htaccess.

One thing I noticed: after I switched Force HTTPS off in aaPanel, a grep for server_port still found that line in the site’s config. I deleted the server soon after, so I did not find out why. After changing the toggle, run the grep again; if the line is still there and not commented out with #, check with step 3 before you edit the file.

Step 5: Check the WordPress address settings

▶ On the server (SSH terminal), only if WP-CLI is installed; use your site’s folder:

wp option get siteurl --path=/www/wwwroot/example.com
wp option get home --path=/www/wwwroot/example.com

What it does: prints the WordPress Address and Site Address. It changes nothing. WP-CLI refuses to run as root without --allow-root; on aaPanel you can run it as the web user instead with sudo -u www wp .... Both should use https and the same host (both www or both non-www) as the address Cloudflare serves. If wp-config.php defines WP_HOME or WP_SITEURL, those win over the database. In my lab both were already https, and the wp-admin loop still happened under Flexible.

The real fix: Full (strict) with a certificate on your server

This is the fix I tested for Cloudflare too many redirects. It works whether the loop comes from the server, from a panel, or from WordPress.

  1. Make sure the server has a usable certificate on port 443. Run the certificate check below. If it prints nothing, there is no working HTTPS yet: install a free Cloudflare Origin CA certificate (my error 526 guide shows that test) or a Let’s Encrypt certificate. My Origin certificate post shows how to create one and install it on aaPanel.
  2. Switch Cloudflare to Full (strict). SSL/TLS, Overview, Configure, Custom SSL/TLS, Full (strict), Save. This is the change that ended both loops in my lab.
  3. Test again. Run the step 1 curl. You should see 200 for a normal page (wp-admin may give one 302 to the login page, which is fine as long as it stops). Browsers can remember a 301, so if curl shows 200 but your browser still loops, clear that site’s cookies and cached files or test in a private window.
  4. Keep or remove the server’s HTTPS redirect. With Full (strict) it is harmless: my 200 came with Force HTTPS still on. You can also let Cloudflare do it with Always Use HTTPS (SSL/TLS, Edge Certificates).

The certificate check. ▶ On the server (SSH terminal):

curl -sSkv -o /dev/null --resolve example.com:443:127.0.0.1 https://example.com/ 2>&1 | grep -E "subject:|issuer:|expire date:"

What it does: makes an HTTPS request to the web server on this machine and prints the certificate’s subject, issuer and expiry date (-k lets curl finish even if the certificate would fail a check). It changes nothing. For Full (strict) the issuer must be Cloudflare Origin CA or a public CA such as Let’s Encrypt, not the server itself (self-signed), the subject must cover your hostname, and the expiry date must be in the future.

Do not jump to Full (strict) without a working certificate. On the same test server, Full (strict) with a self-signed certificate gave error 526, port 443 answering without TLS gave error 525, and nothing listening at all gave error 521. Plain Full accepted my self-signed certificate because it does not check it, so I use Full (strict).

Fix the WordPress wp-admin redirect loop

If only /wp-admin/ or /wp-login.php loops and the front page works, WordPress is the one redirecting. When the WordPress Address starts with https, WordPress forces HTTPS on the admin area. Under Flexible, PHP sees plain HTTP from Cloudflare, so WordPress sends wp-admin to HTTPS again and again. In my capture the header said X-Redirect-By: WordPress.

The proper fix is the same: certificate on the server and Full (strict). If you cannot do that yet, the patch below tells WordPress to trust the HTTPS header that Cloudflare adds.

▶ In wp-config.php, above the line /* That's all, stop editing! */ (changes how WordPress detects HTTPS; back up the file first):

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

What it does: if the request arrived at Cloudflare over HTTPS, WordPress treats it as HTTPS, so it stops redirecting. I did not test this snippet in my lab. It is a patch, not a fix: traffic between Cloudflare and your server is still unencrypted, and anyone who can reach your server directly can send that header too.

If you must keep Flexible SSL

Some hosts cannot install a certificate. Then follow Cloudflare’s other route: remove every HTTP-to-HTTPS redirect on the server (panel Force HTTPS, Nginx or .htaccess rules, SSL plugins), add the wp-config patch above for WordPress, and turn on Always Use HTTPS in Cloudflare so the redirect happens at Cloudflare instead.

Treat it as temporary. Flexible leaves the Cloudflare-to-server leg as plain HTTP, and my Cloudflare settings for WordPress guide explains why I use Full (strict). If your host cannot give you HTTPS, a small VPS can; I tested Vultr, Hetzner and DigitalOcean with real numbers.

What each SSL mode did on my test server

All from the same test server and Cloudflare zone on 20 November 2026. It shows why changing the mode alone is not enough; the server has to match it.

Cloudflare modeServer stateResult
FlexibleWordPress, no server redirect302 loop on wp-admin (X-Redirect-By: WordPress)
FlexibleaaPanel Force HTTPS on301 loop, ERR_TOO_MANY_REDIRECTS
Full (strict)Origin CA certificate, Force HTTPS on200 OK, no redirect
Full (strict)Self-signed certificate526 in 0.27 to 1.25 s
FullSelf-signed certificate200
Full or Full (strict)Port 443 answering plain HTTP525 in 0.23 to 0.83 s

The headers in these captures also show cf-cache-status: DYNAMIC, which only means Cloudflare did not serve the response from its cache; my cf-cache-status guide explains the values.

Does Cloudflare affect WordPress?

Cloudflare does not break WordPress by itself, but its SSL/TLS mode has to match how your server and WordPress handle HTTPS. For WordPress, Cloudflare’s redirect page also suggests its WordPress plugin and Automatic HTTPS Rewrites (I did not test either here). Other Cloudflare errors, such as 522, 520 and 524, come from the server and its software, not from the SSL mode. My Cloudflare settings for WordPress guide lists the settings I use.

How to prevent redirect loops behind Cloudflare

Most Cloudflare too many redirects cases start when one side changes and the other does not: a new SSL mode, a panel toggle or a plugin. These habits avoid that.

  • Put a certificate on the server before you add a site to Cloudflare, then choose Full (strict) from day one.
  • Set the mode yourself. Use Custom SSL/TLS so you know which mode is active.
  • Have one place that redirects to HTTPS. Either Cloudflare’s Always Use HTTPS or the server, and only one rule for www vs non-www.
  • Test with curl after every SSL or redirect change, and grep the config after switching a panel toggle off.
  • Keep the WordPress Address and Site Address on https and on the same host that Cloudflare serves.

Cloudflare too many redirects FAQ

Why does Cloudflare keep redirecting me?

Cloudflare too many redirects usually happens because the SSL/TLS mode is Flexible and the website’s server or WordPress forces HTTPS. Cloudflare connects to the server over HTTP, the server says go to HTTPS, and the loop repeats. Full (strict) with a certificate on the server ends it.

How to fix redirect error in WordPress behind Cloudflare?

Check the loop with curl. If it points to the same https address, install a certificate on the server and set Cloudflare to Full (strict). If only wp-admin loops, WordPress is the one redirecting; the same fix works, and a wp-config snippet that trusts X-Forwarded-Proto is a temporary patch.

Will clearing cookies fix too many redirects?

It can on the visitor’s side if a stale cookie caused it. If the loop comes from the site’s settings, it comes back right away, and only the site owner can fix it.

Does Always Use HTTPS cause too many redirects?

Only together with a server rule that sends HTTPS visitors back to HTTP. On its own it is the safer way to force HTTPS. I tried that case in my lab but could not reproduce it.

Should I use Full or Full (strict)?

Full (strict). Both connect to your server over HTTPS and both end a Flexible loop, but only Full (strict) checks the certificate. In my lab Full accepted a self-signed certificate that Full (strict) rejected with error 526.

Is Flexible SSL safe?

It encrypts only the visitor-to-Cloudflare part. The connection from Cloudflare to your server is plain HTTP, and Flexible is a frequent cause of redirect loops. Use it only as a short-term option.

Why does only wp-admin loop?

WordPress forces HTTPS on the admin area when its address starts with https. Under Flexible it sees plain HTTP, so it keeps redirecting wp-admin while the front page may still load. That is what my curl capture showed.

Why is Cloudflare blocking me from websites?

That is a different problem. A block or challenge page comes from the site’s Cloudflare security settings. Too many redirects is a loop between addresses, not a block.

Related Guides