A URL map is a set of Google Cloud configuration resources that direct requests for URLs to backend services or backend buckets. The URL map does so by using the hostname and path portions for each URL it processes:
- A hostname is the domain name portion of a URL; for example, the hostname portion of the URL
http://example.net/video/hd
isexample.net
. - A path is the portion of a URL following the hostname and optional port number; for example, the path portion of the URL
http://example.net/video/hd
is/video/hd
.
This diagram shows the structure of the load balancing configuration objects in relation to each other.
The simplest URL map only has a default backend service or a default backend bucket. It contains no host rules and no path matchers. Either the default backend service or the default backend bucket (whichever one you defined) handles all requested URLs
Path matchers (and URL maps in general) don’t offer features that function like Apache LocationMatch
directives. If you have an application that generates dynamic URL paths that have a common prefix, such as /videos/hd-abcd
and /videos/hd-pqrs
, and you need to send requests made to those paths to different backend services, you might not be able to do that with a URL map. For cases containing only a few possible dynamic URLs, you might be able to create a path matcher with a limited set of path rules. For more complex cases, you need to do path-based regular expression matching on your backends.