What is the "ERR_TOO_MANY_REDIRECTS" Error

The ERR_TOO_MANY_REDIRECTS issue ("Cyclic redirection on the page") or "redirect loop" occurs when the server alternately redirects the client to different addresses, the last of which redirects to the first address, thus creating an endless loop of redirects. Most often, the cycle does not contain a large number of addresses - usually these are 2 addresses that redirect the client to each other, for example https://www.example.com -> redirect -> https://example.com -> redirect -> https://www.example.com and so on ad infinitum.

How to fix ERR_TOO_MANY_REDIRECTS error

If you encounter this error, you need to check the use of redirects in the server settings, in the .htaccess file (if it's used), as well as in the web application itself. It is very important to determine where from and where to redirects occur. You can use specialized browser plugins for this.

But what if the website works fine, and the ERR_TOO_MANY_REDIRECTS error does occur only when the Cloudflare service is turned on

Most often, this situation occurs due to the SSL/TLS settings in Cloudflare, namely because of the encryption mode. The fact is that in Cloudflare, the Flexible mode of SSL/TLS encryption is set as default. This means that traffic between the client and Cloudflare will be encrypted (an https connection will be used), and traffic between Cloudflare and your server will not (a regular http connection will be used). If your server has configured http to https redirection, an endless loop of redirects https -> http -> https -> http ... arises.

To solve this problem, you need to change the SSL/TLS encryption mode in the Cloudflare settings to "Full" or "Full (strict)" (the only difference is that Full mode allows you to use self-signed certificates on the server).