Enforcing HTTPS on GitHub Pages Served via an External Domain Name

1 minute read

It took me an embarassingly/surprisingly long time to realise that the HTTPs certification on this blog had failed, and the page was not opening with an https connection. The culprit for this breakage was this change that GitHub made in 2018(I’m not sure that the SSL certificate for this website had been broken since then…), when they changed the suggested IP addresses to put on the A records for domains that used GitHub Pages. What should’ve been a relatively (at least in theory) easy change to make, turned out to be anything but. It also was yet another example on how poorly designed web applications(which in this case, is the JustHost admin portal) are in general, and how it is almost a borderline miracle that so much software with real world usage has been built over the years.

To save myself(and any potential readers who are frantically searching for similar issues) from the hassle of re-tracing the steps that I used for fixing this error, here is what I did.

  1. Navigate to the admin panel of your domain host, and change the A records to the new ones mentioned in this post. It takes upto 24 hours for the records to be percolated across the different CDNs. You can use this website to check whether the A records for your domain have been updated before proceeding to step 2.

  2. Refer to this excellent blog post written by Rebecca Varley on how to navigate to the CPanel of your domain host, and to refresh the SSL certificate of your site.

  3. In the root of your project’s GitHub repository , check that there is a CNAME file with the name of your domain, preceded by www(this was a critical mistake in my case. I’m not sure when were the settings changed to make it mandatory for the domain name to be pcededed by www).

4.Follow the steps in the comment by Hugolpz in this Stackoverflow thread.

And that should do the trick.

Updated:

Leave a Comment