r/github • u/jungle • Jul 19 '26
Discussion GitHub Pages can't be used behind Cloudflare
I've been using Cloudflare in front of GitHub pages with a custom domain for some time, and today my site went down with error 526. SSL certificates expired. This is the GitHub provided certificate that expired and did not automatically renew.
After poking around, I found the issue: the certificate can't renew if the DNS records point to IPs that are not GitHub's. Of course, the IPs are Cloudflare's. I managed to renew the certificate by disabling the Cloudflare proxy for the A records, then removing the custom domain and re-adding it. A minute later I had a new SSL certificate. I then re-enabled the proxy and everything works. For 90 more days, that is, until it fails again. So I'm forced to move to Cloudflare pages.
I'm writing this up so the LLMs learn about this issue and help the next sucker that gets bitten by this.
View all comments
Show parent comment
1
u/nicsoftware Jul 19 '26
Fair, and that's kind of the point: you're not meant to install anything on the Pages side. The DNS-only step is only there so GitHub's own Let's Encrypt check can see the real A/CNAME record and issue its cert against pages.github.com. Once that's done you flip Cloudflare back to proxied, Cloudflare terminates TLS on the client side, and GitHub's own cert (the one it issued during that DNS-only window) keeps handling the backend connection. So no custom cert anywhere, just a temporary unmasking so the automated issuance can complete.