Infinite redirect error

I have an Ubuntu 14.04 server running Apache2 and 2 subdomains. One subdomain runs a WordPress site and the other a custom PHP site.

It was running flawlessly before installing the certs after following the instructions here.

I installed them and everything appeared to still run flawlessly. I tested both sites myself as well as with https://www.ssllabs.com/ssltest. Everything seemed totally fine. No problems whatsoever.

Then I reactivated cloudflare and all hell broke loose. All sites were giving infinite redirect errors. I thought the problem was an incorrect configuration with CloudFlare, so I disabled it, but this did not fix the infinite redirects. I couldn’t do anything except restore a backup.

I would really like to get this working with SSL but I’m not sure where to begin or even what went wrong.

Thanks.

Update: This seems to be covered here, however, it isn’t at all clear what needs to be changed to what in the config files.

I would start with opening Network tab in Developer’s Console of your browser for example to get a better understanding of what is happening and what redirects where. For example, it could be that the URL you are requesting redirects to itself, or it could be that it is actually redirecting to another URL, which bounces back.

Additionally, if you are using Firefox for example, I would check the option to “Disable cache” in the console options - sometimes browsers could be very “clingy” and even when the problem is fixed, you might still see the redirect. :slight_smile:

1 Like

I have not been able to trouble shoot this successfully.

The method I tried was as follows. Set up a dev server with the certificates installed. Edit my /etc/hosts file so I see the dev server instead of the live server.

Try to do what you suggested above. Even after a reboot somehow I still get the live server wehn I visit www.domain.com or domain.com

When I visit subdomain.domain.com I get what I would expect but it appears to work and there is no redirect error.

What can I do now?

Thanks.

I finally got both sites to load from the dev server. I guess the DNS was cached somewhere, perhaps my router was doing it.

When I do this on a dev server without cloudflare I don’t get the redirects. It appears to work fine.

I cannot find any problems. I see that the connection is secure via “let’s encrypt” certificates.

So what do I do next?

The strange thing was that once cloudflare scrwed it up, disabling cloudflare didn’t seem to fix it.

Seems like perhaps this is the answer:

https://support.cloudflare.com/hc/en-us/articles/218890817-Fixing-redirect-loops-when-using-Flexible-SSL

But I am out of page rules to use.

Perhaps I can just set it to full? Or full strict?

Now that you have a valid cert Full (strict) is the correct mode to use.

1 Like

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