I made a page rule to exclude one folder from the HTTP → HTTPS redirection, but it’s not working.
When I open an URL from that folder via HTTP, it redirects it to HTTPS, then back to HTTP and it continues redirecting back and forth in an enldess loop until the “too many redirects error appears”:
I’m pretty sure the problem is not on my server side, because when I disable CF proxy for the domain svipopusti.hr, and set it to DNS Only, the problem doesn’t occur, and the files inside the “.well-known” folder can be loaded over HTTP. When I turn the proxying back on, the problem returns. Also, it works on the subdomain which is permanently setup to DNS Only:
The issue will be that you set SSL to Off in your first page rule. This implies a redirect from HTTPS to HTTP, however at the same time you seem to have “Always use HTTPS” which redirects from HTTP to HTTPS. Hence you will get two redirects from two different layers on Cloudflare.
There is a solution for this but first I’d like to clarify why you’d like to disable HTTPS in this case. As I said, the origin does serve the file via HTTPS as well.
I need HTTP access because cPanel AutoSSL tries to access a file in the .well-known folder when it’s renewing the SSL certificate. It does so via HTTP and it fails to renew when the URL is redirected to HTTPS.
Please share the solution. If there’s a way to remove the HTTP -> HTTPS redirection only for the .well-known folder by using Cloudflare without doing redirects on my server, that would be a charm!
In that case you will probably have to change your approach and disable the global “Always use HTTPS” setting and set that via the second page rule instead. Otherwise the request will always be redirected to HTTPS, which you obviously dont want.
I’ve seen this requirement before, so I’ve disabled “Always Use HTTPS” in the SSL Edge Certificates section. My sites already have HSTS enabled, and are on the HSTS preload list, so browsers won’t even try HTTP, but SSL verification still has HTTP access to the server.
I encountered this problem with letsencrypt cert renewals too. And my server firewall is routinely blocking port 80. So when I renew I open the firewall, then pause Cloudflare. Do the cert renew before restoring the firewall and CF. Since I do the renewal manually it’s only a couple more steps.