2

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?

2 Answers2

0

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!

J.M. Robles
  • 925
  • 6
  • 9
  • As I stated in my orignal post I already have that option enabled. – KingofGamesYami Jul 14 '19 at 20:35
  • Yes, you mentioned that, but what the web page recommends is to remove your custom domain, then save, then add it back. Apologies if you have already done it and it didn't work. – J.M. Robles Jul 15 '19 at 05:18
  • It worked, as far as that tutorial intends it to work. `https://example.com` is 100% functional including SSL support. My issue is that I want all requests to `https://www.example.com` to redirect to `https://example.com`, which is not working and not covered by the tutorial you linked. – KingofGamesYami Jul 15 '19 at 05:45
0

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.