When using Cloudflare services, your website may encounter the ERR_TOO_MANY_REDIRECTS error or the message «The page isn’t redirecting properly.» This issue occurs when users get stuck in a redirect loop, where requests between HTTP and HTTPS repeat indefinitely. Additionally, in some cases, this problem can impact the proper loading of images.
Common Causes of Redirect Loops
The redirect loop can result from the following incorrect configurations:
- Inadequate SSL/TLS encryption mode.
- Conflicting settings in SSL/TLS > Edge Certificates.
- Misconfigured redirection rules.
Recommended Solutions
- Incorrect Encryption Mode Settings
The SSL/TLS encryption mode of your domain on Cloudflare determines how Cloudflare connects to your origin server and validates SSL certificates presented by your origin. Conflicts in this configuration can cause redirect loops.
Flexible Encryption Mode
If your domain is configured in Flexible mode, Cloudflare sends unencrypted requests to your origin server over HTTP. If your origin server redirects all HTTP requests to HTTPS, a redirect loop occurs.
Solution: Remove HTTPS redirects from your origin server or upgrade the SSL/TLS encryption mode to Full or Full (Strict), which requires an SSL certificate configured on your origin server.
Full or Full (Strict) Encryption Mode
If your domain’s encryption mode is set to Full or Full (Strict), Cloudflare sends encrypted requests to your origin server over HTTPS. A redirect loop will occur if your origin server redirects all HTTPS requests to HTTP.
Solution: Remove HTTP redirects from your origin server.
- Edge Certificate Configuration Always Use HTTPS
If you have «Always Use HTTPS» enabled for your domain, Cloudflare will redirect all HTTP requests to HTTPS. If your origin server redirects all HTTPS requests to HTTP, this will cause a redirect loop.
Solution: Remove HTTPS redirects from your origin server or disable «Always Use HTTPS» in Cloudflare.
HTTP Strict Transport Security (HSTS)
If HSTS is enabled, Cloudflare instructs compatible web browsers to transform HTTP links into HTTPS links. A redirect loop will occur if your origin server redirects all HTTPS requests to HTTP or if your domain has encryption mode disabled.
Solution: Remove HTTPS redirects from your origin server and ensure that your domain’s encryption mode is Flexible or higher. Alternatively, disable HSTS.
- Conflicting Redirection Rules
Redirect loops can also occur due to conflicting URL redirections in your Cloudflare configurations.
Solution: Review your various redirection rules and page rules to ensure that none of them conflict with each other.
Conclusion of Solutions
Typically, implementing the above solutions suffices to resolve the issue, such as upgrading the SSL/TLS encryption mode to Full or Full (Strict) and removing HTTPS redirects from your origin server or disabling «Always Use HTTPS» in Cloudflare. However, if adjusting these settings does not resolve the issue, it is advisable to contact your hosting provider or site administrator for further assistance.