Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

URL map missing a host rule

In the following URL map example:

https://cloud.google.com/load-balancing/docs/url-map-concepts#example-url-map-workflow

there is a following host rule:

```

hostRules:
- hosts:
  - '*'
  pathMatcher: video-matcher

```

But this host rule has not been created. Shouldn't there be another command as follows:

gcloud compute url-maps add-host-rule video-org-url-map \
    --hosts=* \
    --path-matcher-name=video-matcher

Please let me know.

0 2 151
2 REPLIES 2

my understanding was incorrect.

it looks like  that the wildcard host rule matching all hosts and pointing to the pathMatcher `video-matcher` appears by default even without adding any host rule to the url map.

So the current configuration in the documentation is correct.

Please let me  know.

Hi @mountaincode2 

Welcome to Google Cloud Community!

Yes, based on your provided document, the path routing rules in video-matcher to all incoming requests, regardless of the hostname, due to the * wildcard. It simplifies the setup when you want a consistent routing behavior for all hostnames, directing traffic to the correct backend services based on the URL path.

I hope the above information is helpful.