CloudFlare is a popular CDN service provider in the world, when many friends use CloudFlare to provide CDN service for WordPress site, they will encounter the error "Redirected you too many times", which causes the site can not be opened, and the error message in Chome is "ERR_TOO_MANY_REDIRECTS", this error is caused by improper setting of Cloudflare SSL. An alternative to this error is a cyclic redirection of pages, which is caused by improper Cloudflare SSL settings.
CloudFlare Causes of Excessive Redirects
When a website opens CloudFlare service, when a user accesses our website, he/she actually accesses the Cloudflare server which is closer to the user, and Cloudflare then proxies the user to request our source server in order to accelerate and protect the source server.The process of Cloudflare proxying the user to request our source server to get the web resources is calledregression (psychology)The
The error that Cloudflare causes with circular redirects is in the process of going back to the source, and the reason for this error is the redirection between http and https.
Cloudflare Crypto has 4 options in SSL (below), where Off is to not enable SSL and access the site via HTTP protocol. The other 3 options are to access the website via HTTPS protocol.
- Flexible: Enable this option when our source site is not configured with HTTPS support and Cloudflare will access our site via the HTTP protocol when going back to the source.
- Full: When our source website supports HTTPS, but the HTTPS certificate doesn't match the domain name or it is a self-signed certificate, Cloudflare will access the source website via the HTTPS protocol, but will not validate the certificate, i.e., even if the HTTPS certificate provided by our source website isn't trusted by the browser, Cloudflare will access the source website via the HTTPS back to the source site.
- Full(strict): when our source site supports HTTP and the certificate is valid (not expired and trusted). cloudflare accesses the source site over the HTTPS protocol and validates the certificate during each request.
After understanding the function of each of the above settings, let's take a look at how Cloudflare's circular redirection problem occurs. With SSL turned on in Cloudflare, the following two conditions need to be met for a circular redirect to occur when accessing a website:
- With Flexible set in SSL, the CDN returns to the source site using the HTTP protocol.
- The source site supports HTTPS and is set to automatically jump to the HTTPS protocol when accessed via the HTTP protocol.
By this point, some of you may have noticed a problem, we accessed Cloudflare's CDN When the server, is accessed via HTTPS, CDN access to the source site, is accessed via HTTP, HTTP on the source site and automatically jumped HTTPS, a perfect cycle of redirection. Redirected more often, the browser will put down a report ERR_TOO_MANY_REDIRECTS error.
Solution to CloudFlare causing excessive redirection problem
Knowing the cause of circular redirection, we also know how to solve this problem, through testing, the following two settings can solve the Cloudflare circular redirection problem.
- Select Full(strict) or Full(strict) in SSL, so that the CDN will use HTTPS to return to the source, and there will be no HTTP, so there will be no jumping around.
- The source site does not have HTTPS support or does not have HTTP hopping HTTPS, allowing Cloudflare to use HTTP to fetch resources when going back to the source.
After modifying CloudFlare settings, it may take a few minutes or clearing your browser cache for the changes to take effect.
Besides Cloudflare, this issue may also occur when using other CDN providers. If you encounter the problem of Chrome reporting too many redirects after setting up a CDN, you can find the problem by using the ideas above. If you have encountered similar problems when using other CDNs, feel free to raise the issue in the comments so that more people can see it.
10 thoughts on “WordPress 网站使用 CloudFlare 后提示“将您重定向的次数过多” 的原因及解决办法”
Learn! Mark!
Helpful, thanks a lot!
Google Chrome suggests that the domain name has redirected you too many times.
Try to clear the cookie.
ERR_TOO_MANY_REDIRECTS
How do I fix this?
The article is very clear, refer to it and set it up.
I just clicked on the cloud and forgot to change the ssl, and now CloudFlare can't get in.
I'm in without a trace on my cell phone. Thank you.
It's solved. Thank you.
Thank you, I'm learning.
It seems to still not work, the web space to do ssl authentication, and then do cloudfare cdn full strict, to the end of the instead can not open the web page!
The most reliable solution I've seen so far: the plugin marketplace installs the official CloudFlare plugin