Score:0

Google Cloud Load Balancer with wildcard

de flag

For example, there are the following applications deployed as App Engine and Cloud Run services.

A) app-1-api as Cloud Run service

B) app-2-api as App Engine service

C) app-1-frontend a NextJS app as Cloud Run service

D) app-2-frontend a static website hosted as Cloud Run service

I found an article that describes how serverless NEGs with Google Cloud Balancer can glue all these services together behind a single domain. I would like to achieve the following routing:

  1. A request to api.example.com should hit service A

  2. A request to reporting-api.example.com should hit service B

  3. A request to reporting.example.com should hit service D

  4. If a request matches the path *.example.com and none of the paths 1 - 3, then the request should hit service C.

I haven't found anything in regards to the wildcard subdomain in 4. Is all this possible? If not, what GCP alternatives are there?

Thank you.

Score:0
pe flag

The name of that you are looking for is URL Map.

URL maps are used with the following Google Cloud products:

  • External HTTP(S) Load Balancing (global, regional, and classic modes)

  • Internal HTTP(S) Load Balancing

  • Traffic Director

The hostname must be a fully qualified domain name (FQDN). The hostname can't be an IPv4 or IPv6 address. For example:

Works: example.com

Works: web.example.com

Works: *.example.com

Doesn't work: 35.244.221.250

Check the reference about how to Add a host rule

Before to start with the URL map, please familiarize yourself with URL map concepts., such as:

  1. How URL maps work
  2. Naming
  3. URL map components
  4. URL redirects

For example, with an external HTTP(S) load balancer, you can use a single URL map to route requests to different destinations based on the rules configured in the URL map:

Requests for https://example.com/video go to one backend service.

Requests for https://example.com/audio go to a different backend service.

Requests for https://example.com/images go to a Cloud Storage backend bucket.

Requests for any other host and path combination go to a default backend service.

datalifenyc avatar
cn flag
How would you redirect a subdomain to a bucket subfolder, if you have more than 3 subdomains. Currently, the quota limit for Backend buckets is 3. Initially, I wanted to create a separate Backend bucket for each subdomain, which would resolve this URL redirect issue.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.