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.
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)
Solution
Cloudflare > Website > SSL/TLS (padlock icon)
Set SSL/TSL to “Full”