In this article we’ll see how to configure the HTTPS protocol for site with custom domain hosted on the GitHub Pages.

The Limitation

Configure a custom domain for a site hosted on GitHub Pages is extremely simple, but utilize a custom domain with HTTPS not is a trivial task, for is impossible execute the traditional configurarion process, which basically consists to send and configure at web server the files provided by certificate authority (CA), therefore, is necessary a alternative solution.

The Solution

How is impossible to execute the HTTPS configuration directly on GitHub Pages, we’ll circumvent this limitation using the DNS server to ‘notify’ to clients that site supports HTTPS.

Firstly is necessary have sure that DNS service supports records of type CAA, the certificate authority also needs supports this resource, at article case is used GoDaddy DNS service and Let’s Encrypt certificate authority.

Configure CAA record on DNS

With all requirements attended the next step is configure the DNS, so follow the below steps:

1 - Access the GoDaddy dashboard and go to the DNS manager as indicated at below image:

Access GoDaddy DNS manager

2 - Now click in ‘ADD’ to configure a new record.

Add new DNS record

3 - Select the option ‘CAA’.

select the CAA option

4 - Verify if all fields are filled as the below image, with exception of field ‘Name *’, which in this case is filled with ‘@’, because the sample uses the main domain and not a subdomain as for example: blog.rafaelmoraes.tech, after filled the fields correctly, click on the ‘Save’ button.

Fill record fields fo CAA

5 - Case all fields are filled correctly the new record should appear at the list likewise of image:

CAA configured successfully

Therewith we finished the DNS configuration.

Configure GitHub Pages

With the DNS properly configured, now is necessary to configure the GitHub Pages to force use of the HTTPS, for this access the tab ‘Settings’ on site repository and activate the option ‘Enforce HTTPS’ as can be saw on the follow image:

Configure GitHub Pages enforce HTTPS

Done it, just wait few minutes(on my case was almost instant) that HTTPS will be active and therewith we finished, suggestions and reviews are welcome.

Resources