How to fix the Cloudflare Too Many Redirect Error?

How to fix the Cloudflare Too Many Redirect Error?

When trying to open a website or webpage, you may come across the ‘Too Many Redirect’ error. Its a Redirect loop error caused by the Cloudflare service and there are two reasons behind this error. These are:
  • Cloud SSL settings are not compatible with the configuration of the origin’s web server
  • The Page Rule is misconfigured
This is the message that’s displayed when you come across this error:

Code:
The page isn’t redirecting properly
ERR_TOO_MANY_REDIRECTS
Now let’s look at how to fix this error.

If Cloud SSL is Incompatible

If you have Flexible SSL mode enabled, Cloudflare will send unencrypted requests to origin web server over HTTP. When the origin web server is so configured to redirect HTTP requests to HTTPS for the Flexible SSL mode, then it results in Redirect loop.

The same error can occur if you have selected the Full or Full (strict) mode. There are two ways to fix this error:

The first way is to remove the redirects, either HTTP to HTTPS or HTTPS to HTTP. Here’s an example to demonstrate this:

Code:
Apache – RewriteRules
nginx – Rewrite directives and 301 return directives
The second way is to update the Cloudflare SSL option. If its set to Flexible, change it to Full or Full (Strict) and check if the error is resolved. To change the mode, navigate into the ‘SSL/TLS app Overview tab’.

If Page Rule is Misconfigured

If the Page Rule is not configured properly, you will face redirect loops. In some cases, there are two or more Page Rules with Forwarding URL settings. If they conflict each other, there’s a high chance you’ll get the ‘Too Many Redirect’ error.

To check if there are conflicting rules, navigate into Rules >> Page Rules. Remove some of the rules that are of less importance.

To prevent such things from happening, you can make use of the Cloudflare WordPress plugin at origin web server. Along with that, enable the Automatic HTTPS rewrites option in the plugin.

Other plugins you can install are SSL insecure content fixer or Really Simple SSL.

So that’s how you fix the redirect loops and the Cloudflare Too Many Redirect error.
Author
kumkumsharma
Views
8,172
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top