Cloudflare Pages redirect loop


I’m trying to deploy my blog to Cloudflare Pages with a custom domain but all requests are redirecting to an HTTP URL of the site and then a 1-step redirect loop after that.

I would tell you what the site is, but the forum software says I can’t include links in my posts.

The URL is [redacied] and that one works correctly.

The site is hosted on GitHub and I deployed it with GitHub Actions. I do not have any _redirect files or page rules.

These are the headers I’m getting for the custom domain URL:

$ curl -I
HTTP/2 301 
date: Fri, 24 Jun 2022 23:59:52 GMT
cache-control: max-age=3600
expires: Sat, 25 Jun 2022 00:59:52 GMT
expect-ct: max-age=604800, report-uri=""
report-to: {"endpoints":[{"url":"https:\/\/\/report\/v3?s=DQz99o5rCT3nav62mGK5Hh773cg7y03%2F1%2BvhJdthMYJZ4SJ5LDMzWwH%2FORe0RtHpnzGyjzNGLMql60upDm0Hl7tVB0TuOTyDCwlauBfpmVZ%2F9PYO5ZhP4FGv5hKn5YBNdatR"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 72096b6f8d4c78dc-EWR

I can see the CNAME record in the DNS settings for the domain and it looks correct. But when I query the domain (directly against a Cloudflare resolver), I’m getting A records instead of a CNAME record back:

$ dig

; <<>> DiG 9.16.1-Ubuntu <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64961
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

; EDNS: version: 0, flags:; udp: 1232
;		IN	A


;; Query time: 23 msec
;; WHEN: Fri Jun 24 20:02:40 EDT 2022
;; MSG SIZE  rcvd: 77

It’s been about 45 minutes at this point, does it take a long time for Cloudflare’s DNS servers to update themselves and I’m being impatient, or is there a problem?

The DNS is fine; Cloudflare turns that into an A record behind the scenes to do its Magic™️.

Something is creating a redirect from your HTTPS site to HTTP. There’s certainly no switch for that in the settings, so maybe double-check all the settings for your zone?


It turns out you were on the right track. Up until now, I have mainly used Cloudflare for DNS and didn’t bother with any of the other services or settings but at some point I must have turned off SSL/TLS for the reverse proxy service. Couldn’t tell you when or why but ultimately it meant (apparently) that Cloudflare was trying to do an HTTP redirect to itself.

So if anyone else finds this, make sure that SSL/TLS is enabled for the domain or your Cloudflare Pages site isn’t going to work.

Thanks i40west for the tip.


Thanks for clarifying which setting was responsible. It will help in the future :slightly_smiling_face:

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