gavin somers
gavin somers

Reputation: 29

custom domain forwards to cloud run service but still see original service url not custom domain

I own a domain in google domains. I run a cloud run "fully managed" service under the same google account.

When someone types in my custom domain I want them to end up at my cloud service but I want them to see the custom domain in the url bar. However although I have followed the instructions on https://cloud.google.com/run/docs/mapping-custom-domains although the user gets redirected they see the cloud run service url rather than the custom domain.

My current config is as follows:

  1. In gsuite At https://admin.google.com/ac/domains/manage I have configured the naked domain to redirect to www version

  2. In cloud run under custom domains I have mapped my naked domain (got set of A and AAAA records to add as custom resource records in google domains) and www version (got cname ghs.googlehosted.com. record to add to custom resource records in google domains) to cloud run service.

3)In google domains under synthetic records enabled gsuite and in custom resource records have added above records.

Getting very frustrated as I cannot get the cloud run service to show the custom domain.

Pleas help. Thank you.

Upvotes: 2

Views: 993

Answers (1)

Puteri
Puteri

Reputation: 3789

I think the issue is related to the first step as mentioned by @guillaume-blaquiere.

If you're doing an HTTP redirection (301 or 302 HTTP responses) the behavior you see is expected.

I would suggest to set the AAAA and A records to the IPs provided by Cloud Run and set the www to ghs.googlehosted.com.

In case you may want to redirect the www subdomain to the naked domain, you may want to create a CNAME record which points to the naked domain (@).

Finally, I would suggest to these all these changes in Google Domains rather than in the GSuite Admin Console.

Upvotes: 1

Related Questions