Resolve redirect loop (too many redirects) errors that prevent visitors from viewing your website.
The two typical causes of redirect loop errors are:
- Cloudflare SSL options that are incompatible with your origin web server’s configuration, and
- Page Rule misconfiguration.
Browsers typically display error messages when redirect loop errors occur, such as:
- The page isn’t redirecting properly
Cloudflare SSL options incompatible with your origin web server
The most common cause of redirect loops is due to a combination of
- a redirect performed by your origin web server, and
- a Cloudflare SSL option that is incompatible with the redirect performed by your origin.
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.
Resolve redirect loops via one of the following methods:
- (Recommended) Remove the HTTPS to HTTP or HTTP to HTTPS redirects from your origin web server configuration. For example:
- Apache - RewriteRules
- nginx - Rewrite directives and 301 return directives
- 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.
Page Rule misconfiguration
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.
Check the rules in Rules > Page Rules to confirm if you have two rules configured to forward traffic to each other.