By default when I imported my DNS records from Namecheap to Cloudflare the Encryption Mode is set to Flexible, which causes a redirect loop since the Github Pages site is set to enforce HTTPS.

When using Github pages for hosting and Cloudflare for DNS routing, we need to use Full SSL in Cloudflare instead of flex SSL so that we don’t get caught in a redirect loop.

2023-06-26 TIL Use full-ssl to avoid redirects-1687754997573

Source https://developers.cloudflare.com/ssl/troubleshooting/too-many-redirects/

This happens if the Enforce HTTPS button is checked on our Github Pages site (Repo > Settings > Pages > Custom Domain) 2023-06-26 TIL Use full-ssl to avoid redirects-1687755032493

Solution

Cloudflare > Website > SSL/TLS (padlock icon)  200

Set SSL/TSL to “Full” 2023-06-26 TIL Use full-ssl to avoid redirects-1687755383956