Setting up HTTPS for Github organization pages with custom domains

1 minute read

Thanks to Robin Winslow for the original post.

Github Organization pages are awesome, but they do not support HTTPS, presumably because doing so would require Github to serve up your domain-specific SSL certificate for incoming requests - which would be a real pain for them to manage.

Robin Winslow has written a great tutorial which explains how get around this limitation by also setting up Cloudflare account and using that to “layer on” SSL - all for free.

My requirements were slightly different to Robin’s, in that I needed to set up an apex domain (i.e. mydomain.com) rather than a subdomain, as Robin does. Here is the process I followed…

Note: Replace myorg with your organization name in the instructions below.

1. Setup Github organization repository

Create a new Github organization, e.g. myorg. Your organizations repositories will from now on be visible at https://github.com/myorg.

Now create a public repository within the organization named myorg.github.io. Commit an index.html file to this repo. You should now be able to view your site at https://myorg.github.io.

Go into the settings for the repository and set the Custom Domain to myorg.com.

2. Setup Cloudflare

Sign up for a Cloudflare account and setup your DNS A records such that myorg.com point to Github’s IP addresses: 192.30.252.153, 192.30.252.154:

If you like you can also setup records for the www subdomain pointing to the same IP addresses.

Go into the Crypto tab and ensure Flexible is selected as the SSL setting.

Finally, let’s setup page rules to ensure all HTTP traffic is auto-redirected to HTTP.

Create another rule like the above, except set the URL to http://*myorg.com. This will ensure all calls to the base domain (i.e. without a URL path) are also auto-redirected to HTTPS.

3. All done!

After a few minutes/hours you should be able to access your website at https://myorg.com. Try HTTP variants.

Leave a Comment