How to host a custom HTTPS domain at GitHub

githubgithub-pagesssl

I use GitHub pages to host a static website at a custom domain. When I visit http://custom.example.com I get my website as expected. When I visit https://custom.example.com I get a certificate warning:

This server could not prove that it is custom.example.com; its security certificate is from *.github.io. This may be caused by a misconfiguration or an attacker intercepting your connection.

GitHub Help says

HTTPS is not supported for GitHub Pages using custom domains.

I strongly prefer HTTPS over HTTP. Is there any way I can make https://custom.example.com work as expected?

Best Answer

As stated, HTTPS is not currently supported by GitHub Pages. However,

HTTPS for custom domains is one of our most frequent features requests, and I can tell you that it's something we're working on (though I can't specify a timeline for that). - Community manager response ~2017

In the meantime, you can sign up for a gratis Cloudflare account, add your website and make sure the records match your registrars.

For step-by-step instructions see https://hackernoon.com/set-up-ssl-on-github-pages-with-custom-domains-for-free-a576bdf51bc

An important note from that page:

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