GitHub pages is a great place for hosting a static website. It’s easy to add a custom domain name too by pointing the domain name’s name servers to GitHub’s and add a CNAME file to the root of your site and you’re done. If you use a custom domain name though you can’t have the site served over HTTPS by default.
Cloudflare is a great CDN with a generous free-tier which offers free SSL. You can use it with GitHub pages and have your pages served over HTTPS.
Sign up for an account at Cloudflare.com
Add your domain name to Cloudflare
From your domain registrars site change the nameservers of your domain name to point to Cloudflare
Change the A records of your domain to point to GitHub, mine are * points to 18.104.22.168 and christianoliff.com points to 22.214.171.124.
Wait a short while - and you’re done!
Once you’re all setup there’s a range of settings and controls in the Cloudflare admin, and paid-upgrades to premium features available. I recommend setting the ‘Always use HTTPS’ and ‘Automatic HTTPS Rewrites’ options to On (crypto tab).
There are a couple of limitations to be aware of;
- It’s technically not fully encrypted end-to-end. It’s Flexible SSL which means its encrypted from Cloudflare to the visitor, but not from GitHub to Cloudflare.
- SSL cert will only work on https://example.com and not https://www.example.com (who needs www. in their URLS now anyway?)
Leave a Comment
Your email address will not be published. Required fields are marked *