HTTPS on Github Pages with a Custom Domain
September 03, 2017Update: Custom domains on GitHub Pages gain support for HTTPS
Since all browsers are trying to force HTTPS; it is highly recommended to setup it up on your domain name; however for websites with custom domains hosted on Github pages it wasn’t supported because the certificates provided by Github is specific for *.github.io
domains.
Thanks to CloudFlare, this became possible using the following steps:
- Go to cloudflare.com and create a free account
- Make sure that your
gh-pages
branch contains a CNAME file and the domain is added correctly - Add your website to CloudFlare, you will be provided with new nameservers to use and they will contain all the old A records, which will make the transition from Github to Cloudflare easy with no downtime at all
- Open CloudFlare settings for your domain and Change the SSL to ‘Full’
- Open page rules for your domain and add a new page rule
Please note that these changes may take up to 24 hours to propagate correctly. Until Github provides a native solution, this is the quickest way to accomplish this.