Troubleshooting redirect loop errors

Resolve redirect loop (too many redirects) errors that prevent visitors from viewing your website.


Overview

The two typical causes of redirect loop errors are:

Browsers typically display error messages when redirect loop errors occur, such as:

  • The page isn’t redirecting properly
  • ERR_TOO_MANY_REDIRECTS
For assistance determining if your origin web server is responding with redirects, contact your hosting provider or site administrator.

Cloudflare SSL options incompatible with your origin web server

The most common cause of redirect loops is due to a combination of

  1. a redirect performed by your origin web server, and
  2. a Cloudflare SSL option that is incompatible with the redirect performed by your origin.

Cause

The Flexible SSL encryption mode in the Cloudflare SSL/TLS app Overview tab encrypts traffic between the browser and the Cloudflare network over HTTPS. However, when the Flexible SSL option is enabled, Cloudflare sends requests to your origin web server unencrypted over HTTP. Redirect loops occur if your origin web server is configured to redirect all HTTP requests to HTTPS when using the Flexible SSL option.

Redirect loops may also occur when using the Full or Full(strict) SSL option.  The only difference is that Cloudflare contacts your origin web server over HTTPS and the redirect loop occurs if your origin web server redirects HTTPS requests to HTTP.

Resolution

Resolve redirect loops via one of the following methods:


1. (Recommended) Remove the HTTPS to HTTP or HTTP to HTTPS redirects from your origin web server configuration. For example:

For assistance configuring your origin web server, contact your hosting provider or site administrator.

2. Update the Cloudflare SSL option in the SSL/TLS app Overview tab:

  • If currently set to Flexible, update to Full if you have an SSL certificate configured at your origin web server.
  • (Not Recommended) If currently set to Full, update to Flexible.
Utilizing the Off SSL option and enabling HSTS either at Cloudflare via the SSL/TLS app or at your origin web server also causes redirect loops. Either adjust the SSL option to Flexible or Full, or disable HSTS.

Page Rule misconfiguration

Cause

Redirect loops also occur if two conflicting Page Rules are configured with Forwarding URL settings. For example, one Page Rule redirects traffic for a.example.com to b.example.com and another page rule redirects traffic for b.example.com to a.example.com.

Resolution

Check the rules in your Cloudflare Page Rules app to confirm if you have two rules configured to forward traffic to each other.

To reduce the potential for redirect loops and mixed content errors, Cloudflare recommends Wordpress users to install the Cloudflare WordPress plugin at their origin web server and enable the Automatic HTTPS rewrites option within the plugin. Alternatively, Cloudflare recommends the SSL insecure content fixer or Really Simple SSL plugin.

Related resources

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk