Skip to main content

Forwarding www subdomain with SSL github pages [Resolved]

I've set up a personal website on my apex domain using Github Pages and Google Domains.

I've tried to forward www.example.com to example.com which works unless you type in https://www.example.com, which results in NET::ERR_CERT_COMMON_NAME_INVALID, claiming the security certificate is from www.github.com not www.example.com

Note that I also have "enforce https" turned on in GitHub Pages.

Export of my DNS records:

example.com. 21600 IN SOA ns-cloud-b1.googledomains.com. cloud-dns-hostmaster.google.com. 23 21600 3600 259200 300
example.com. 21600 IN NS ns-cloud-b1.googledomains.com.
example.com. 21600 IN NS ns-cloud-b2.googledomains.com.
example.com. 21600 IN NS ns-cloud-b3.googledomains.com.
example.com. 21600 IN NS ns-cloud-b4.googledomains.com.
example.com. 3600 IN A 185.199.108.153
example.com. 3600 IN A 185.199.109.153
example.com. 3600 IN A 185.199.110.153
example.com. 3600 IN A 185.199.111.153
example.com. 3600 IN CAA 0 issue "letsencrypt.org"
example.com. 3600 IN MX 5 gmr-smtp-in.l.google.com.
example.com. 3600 IN MX 10 alt1.gmr-smtp-in.l.google.com.
example.com. 3600 IN MX 20 alt2.gmr-smtp-in.l.google.com.
example.com. 3600 IN MX 30 alt3.gmr-smtp-in.l.google.com.
example.com. 3600 IN MX 40 alt4.gmr-smtp-in.l.google.com.
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all"
www.example.com. 3600 IN CNAME example.com.

What is the proper way to forward the www subdomain which will not result in problems with SSL?


Question Credit: KingofGamesYami
Question Reference
Asked July 18, 2019
Posted Under: Network
32 views
2 Answers

After some configuration I found the answer:

The proper way to forward a subdomain as I wanted was to add a synthetic record in Google Domains, redirecting to https://example.com with SSL enabled. It will initially tell you the record has an error with the certificate but this will resolve itself within a day or two.


credit: KingofGamesYami
Answered July 18, 2019

In How to setup google domain for github pages, you can see, in the fourth step:

Go to your github repository settings page, under Settings > GitHub Pages > Custom domain remove your custom domain and save. GitHub Settings Github Pages.

Then add it back and save again. Now you should be able to check the "Enforce HTTPS" checkbox and secure your site!


credit: J.M. Robles
Answered July 18, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA