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.
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 18.104.22.168 and 22.214.171.124 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 — 4 A records point to 126.96.36.199, 188.8.131.52, 184.108.40.206 and 220.127.116.11 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).