arao6
arao6

Reputation: 3376

Cloud Run - Custom Domain Mapping with Wildcard Subdomain

Our app utilizes subdomains like customerA.mydomain.com or customerB.mydomain.com, wherein the subdomains are unique publicly accessible storefronts that are "created" by our customers. We would like to route all *.mydomain.com to a particular Cloud Run service. We have already set up a wildcard subdomain CNAME in the DNS records to route to ghs.googlehosted.com., but how can we make Cloud Run accept requests from any subdomain?

Upvotes: 4

Views: 2634

Answers (1)

Pentium10
Pentium10

Reputation: 207912

You will need to map each subdomain to a service using API or gcloud commands. For example:

gcloud run domain-mappings create --service=myapp  --domain=www.example.com

Technically this is because each service is with provisioned HTTP SSL certificate (built-in and provided out-of-the box for you without any charge), and there is no wildcard certificate issued by Google for your domain. That's why you cannot map a *(star) to a service. This means you need to instruct GCP Cloud Run service to map and issue a certificate request for each of your subdomain.

Also reach out to your Account Manager, as there are other limits on Cloud Run such as:

Maximum number of SSL certificates: 50 per top domain and per week

Upvotes: 4

Related Questions