April 13, 2020

Add https to your Namecheap Domain hosted on Github Pages

Namecheap offers a custom ‘.me’ domain in the Github Developer Pack free, for a year and Github Pages is a great free hosting option for your static site.

Github recently provided a long awaited feature — using https on custom domains. But the configuration required to use https on your namecheap domain with Github Pages is a bit different than mentioned in the Official Namecheap documentation (maybe the documentation hasn’t been adapted to the new ‘https on custom domain’ feature yet).

I recently migrated my Portfolio website from http to https with some help from the Github Support team and so I thought of publishing this article for anyone who might be facing issues in Enforcing https to their Github Pages site using Namecheap domain.

The Process

When I initially visited my Portfolio’s Github Repository’s setting page to activate https on it, I faced this error-

Unavailable for your site because your domain is not properly configured to support HTTPS

At this stage, I had two A records and one CNAME record configured in the advanced DNS section of my Namecheap account. The CNAME record had the host as “www” and the value was “myGithubUsername.github.io”. The A records pointed to 192.30.252.153 and 192.30.252.154 respectively. This configuration was as per the Official Namecheap Documentation.

This configuration doesn’t allow using https on your custom domain. So, the modified configuration has one CNAME record (same as earlier) and 4 A records (1 minimum and the other 3 optional).

Correct configuration

Correct configuration — 4 A records point to 185.199.108.153, 185.199.109.153, 185.199.110.153 and 185.199.111.153 respectively and the CNAME record points to yourGithubUsername.github.io. The CNAME record is necessary along with atleast one A record (Additional records essentially act as a backup in case of DNS or CDN issues, so having at least two is best practice, though your site will still function with just one).