The ERR_TOO_MANY_REDIRECTS issue - some additional info

So I too hit the ERR_TOO_MANY_REDIRECTS that other users of cloudflare have also hit.

I fixed it by following one of the tips from this post: Community Tip - Fixing ERR TOO MANY REDIRECTS , namely changing the SSL type from Flexible to Full.

However in the interim I did some testing and I found the redirect loop is only being introduced for visits to the root on certain blog platforms. Visits to other sites that use static pages and visits to specific blog posts off the root work fine. i.e. going to blog.mydomain.com (as either http or https) geberates the error. visits to blog.mydomain.com/page or blog.mydomain.com/tag/sometag or anything else works fine as will going to www.mydomain.com

This was tested using ghost, but it seems to be a problem with wordpress as well. I’m not clear precisely why but as I can reproduce it at will and by checking the logs on my server I see that it doesn’t get the requests itself as the whole thing is cached by cloudflare (or rather the redirect is generated by it directly).

Specifically this does not generate a hit on my local server:
curl https://example.blog.com/
but returns
<p>Moved Permanently. Redirecting to <a href="https://example.blog.com/">https://example.blog.com/</a></p>

Whereas
curl https://example.blog.com/the-first-post/
shows a hit in the blog log file AND returns the correct html. Also a curl to https://static.blog.com/ which is hosted on the same physical device and passes through the same argo tunnel works fine

If any cloudflare engineer wants to troubleshoot I can tell you precisely how to do it - in fact they can just follow the instructions here - Micronetia Setup and then tweak the ssl settings in the cloudflare dashboard from flexible to full and back again

But, have you had an SSL certificate installed at your host/origin before/after you switched to Full?

Moreover, is it WordPress website?
Have you had it installed at HTTP or HTTPS?
What is in your database under SITE_URL and HOME_URL for a value?

Do you have some redirection enabled at your host/origin?

Can you check your web server settings?

What happens if you make all the DNS records :grey: and click on “Pause cloudflare” at Cloudflare dashboard?
Does your Website resolve and work correctly? If so, is it over HTTP or HTTPS?

Maybe you need to allow Cloudflare to connect to your host/origin first.

What is your domain name?

But, have you had an SSL certificate installed at your host/origin before/after you switched to Full?

I do not have a SSL certificate at my host. It is connected to the cloudflare network via an argo tunnel. The fact that I didn’t have an SSL certificate was why I picked flexible in the first place. Turns out that full works anyway despite there being no certificate on my server. This was a surprise to me

Moreover, is it WordPress website?

I’m using the ghost blogging platform (ghost.org) but reading numerous comments on this forum and elsewhere suggests that the exact same behavior occurs with WP

Have you had it installed at HTTP or HTTPS?
What is in your database under SITE_URL and HOME_URL for a value?

The site is installed as HTTP. There is no HTTPS anywhere on the server. However as noted above the traffic to and from it comes via an Argo Tunnel (the cloudlfared module)

The relevant part of the config file is:
{
“url”: “https://example.devtru.st/”,
“server”: {
“port”: 2368,
“host”: “127.0.0.1”

When I attach locally (i.e. to localhost) I get a redirect to https://example.devtru.st/ which is what I would expect.

The point is that the redirect in Flexible mode does not seem to be generated by my blog. But I don’t fully understand why because as noted in the OP other sites hosted on the same host do not have this issue as do links to individual posts. When I go locally to the specific post I get the expected redirect to the post link.

This behavior looks like a CF bug, and I don’t have sufficient visibility into the CF part to see what is happening. I figure that a cloudflare engineer might want to take a look and see because there are numerous posts in various fora going back years about how CF causes ERR_TOO_MANY_REDIRECTS . It looks to me like the cause is some part of the CF infrastructure trying to be too clever and rewriting something some of the time but not always.

I also think the CF documentation regarding Flexible vs Full should make it clear that using Full works when the server is behind an argo tunnel even if the server doesn’t have a certificate

This topic was automatically closed after 30 days. New replies are no longer allowed.