PRIYANSHU JAIN

@priyanshujain

Set Up SSL on Github Pages With Custom Domains for Free

January 24th 2017

Instructions:

  1. Sign up for Cloudflare if you don’t already have an account.
  2. Add your website, and make sure all automatically generated records match those on your registrar’s website.

3. If you already have a gh-pages website and are simply moving to https, you don’t need to do anything else.

4. If not, and are trying to set up your site at apex, create an A record pointing to Github’s IP addresses, else a CNAME pointing to your-username.github.io.

5. Make sure there’s a CNAME file at the root of your gh-pages repo with your domain name.

6. Make sure there’s a CNAME file at the root of your gh-pages repo with your domain name.

7. Go to your Domain Registrar’s website and change the Domain Name Servers to those Cloudflare provides you with.

8. Finish Setting up your Domain on Cloudflare and go to the Domain Dashboard.

9. Open the “Cloudflare Settings” for your domain, and change the SSL Setting to “Flexible SSL”.

10. Redirect all visitors to HTTPS/SSL using page rule.

11. After a couple of hours, you’ll be able to open yoursite.com with https.

Drawback:

It’s important to note that this setup is not fully secure — the connection between CloudFlare and GitHub pages is not secured. Since GitHub doesn’t have a SSL certificate for your domain, Full SSL is not possible with a custom domain. However, this setup does provide some protection your users (e.g. from the hacker on the same unsecured Wi-Fi network), and it allows your site to behave as if it has SSL (e.g. for web crawlers, APIs).

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMI family. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.
If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

More by PRIYANSHU JAIN

More Related Stories