How to add Free SSL to GitHub Pages
As people may or may not know if you host your site on Github though GitHub pages (which is served on AWS fun fact) and use a custom domain. They don’t support https or also know as an SSL cert.
I recently added SSL to my own site robertgabriel.ninja. So I will show you step by step on how to do it for Free using Cloudflare.
Cloudflare provides free universal SSL for all.
Step one
First visit CloudFlare and create a new account, its free
You will need to add your website. CloudFront will give you two nameservers, that nameserver you will need to add in your domain panel in your domain registrar. This is so cloudflare can handle all the DNS settings directly.
Once you have set your nameserver to cloudflare. You can’t do anything in domain panel in you domain registrar. So if you want to add an new MX record or TXT record, you will have to set them though the Cloudflare DNS menu. Keeping it simple Cloudflare handle your ALL DNS records.
Step Two
Next, add or import all your CNAME or other Records in DNS menu in CloudFlare then click on status.

Step Three
Next, go the Crypto menu. Set flexible SSL, like this.

Next, click on the Page Rules menu.
Enter the following regex pattern http://*.robertgabriel.ninja/*
Click Always on HTTPS , then click update.

In Page rules menu, we force HTTPS the rule. To keep it simple if anyone person tries and to open your site it will redirect from HTTP to HTTPS.
From the above steps you can see, I set an asterisk sign or known as a wildcard to the subdomain, so if people visit a naked version of your site (www or //), it will force to use HTTPS in all subdomains. If you wanted to use just one subdomain (blog.robertgabriel.ninja)you would set it as HTTP://blog.robertgabriel.ninja/*.
Here we are using * at the end of the URL because it makes https in our all subdirectory or subfolder.
Step Four
Now that we have everything set up in CloudFlare. Remember to update your website or site generator to use HTTPS. So images, CSS, javascript are all served over HTTPS. If you don’t do this, you will see a yellow icon in the URL address bar. So make sure all content is served over HTTPS. It took me about 2 hours for it to fully kick in and become https.

If your worried about SEO effects. Make use you use a Canonical link tag. Which helps search engines know which page you want to index in a search result. Make sure you set the HTTPS. Example.
<link rel=”canonical” href=”https://www.robertgabriel.ninja/awards">
My name is Robert James Gabriel, I hack away on machine learning and all parts of software engineering. You can follow me here on twitter. Remember to star and follow me on Medium so we get a safer web.
