paint-brush
Set Up SSL on Github Pages With Custom Domains for Freeby@priyanshujain
19,550 reads
19,550 reads

Set Up SSL on Github Pages With Custom Domains for Free

by PRIYANSHU JAINJanuary 25th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

3. If you already have a gh-pages website and are simply moving to <code class="markup--code markup--p-code">https</code>, you don’t need to do anything else.
featured image - Set Up SSL on Github Pages With Custom Domains for Free
PRIYANSHU JAIN HackerNoon profile picture

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).