Secure your GitHub Pages site with CloudFlare — Enforce HTTPS

Eray Alakese
Aug 28, 2022

--

GitHub Pages is one of the best ways to host your public static HTML sites.

GitHub allows you to use custom domains for your GitHub Pages and explains how to set it up on this page. However, GitHub does not automatically enforce your visitors to the HTTPS protocol.

When I reached the Custom Domain section from the Settings > Pages page, I saw that the Enforce HTTPS option was not selectable.

Unavailable for your site because your domain is not properly configured to support HTTPS
Unavailable for your site because your domain is not properly configured to support HTTPS

Here I got the error “Unavailable for your site because your domain is not properly configured to support HTTPS”. When I checked my CloudFlare DNS settings, everything seemed correct.

CloudFlare GitHub Pages DNS records
CloudFlare GitHub Pages DNS records

I found that when I turned off CloudFlare’s DNS Proxy, GitHub Actions automatically recognized this change and started provisioning the TLS certificate.

TLS certificate is being provisioned. This may take up to 15 minutes to complete. Enforce HTTPS.

After about 15 minutes, the Enforce HTTPS option became available and I successfully enabled it.

Secure your GitHub Pages site with CloudFlare — Enforce HTTPS
Secure your GitHub Pages site with CloudFlare — Enforce HTTPS

--

--