How to map Google Domains domain name to Google Cloud Run project ? I can’t make ‘www’ work

google-cloud-platformgoogle-domains

I've purchased a Google Domains domain name and try to map my Cloud Run project to it.

To do so, in my Google Domain account, I added in the "DNS Settings" page, under custom resource records, two records:

  1. @ A 1h xxx.xxx.xx.xx (ip that I got from the Custom domain mappings -> DNS records in the Cloud run page)
  2. www CNAME 1h example.com.

From what I've read here: https://support.google.com/domains/answer/3251147?authuser=1#zippy=%2Ccname , this should be enough so that my urls "https://example.com" and "https://www.example.com" work but that's not the case. Only "https://example.com" works, and the one with "www" gives me a Google 404 page.

Any idea how I could make the "www" work ?

Thanks!

Best Answer

Finally managed to make it work:

  1. Made two custom mappings in Cloud Run (one for the example.com and one for the www.example.com).
  2. In Google Domains, I added 3 custom resources records:

@ A 1h xxx.xxx.xx.xx

@ TXT 1h "verification_key" # I had to add this record to verify my www.example.com domain

* A 1h xxx.xxx.xx.xx

I think the key to make it work was to map the wildcard to the DNS A ip.

Related Topic