UrlMaps

UrlMaps are used to route requests to a backend service based on rules that you define for the host and path of an incoming URL. 

For a list of methods for this resource, see the end of this page.

Resource representations

This resource defines the mapping from URL to the BackendService resource, which is based on the "longest-match" of the URL's host and path.

{
  "kind": "compute#urlMap",
  "id": unsigned long,
  "creationTimestamp": string,
  "name": string,
  "description": string,
  "selfLink": string,
  "hostRules": [
    {
      "description": string,
      "hosts": [
        string
      ],
      "pathMatcher": string
    }
  ],
  "pathMatchers": [
    {
      "name": string,
      "description": string,
      "defaultService": string,
      "pathRules": [
        {
          "service": string,
          "paths": [
            string
          ]
        }
      ]
    }
  ],
  "tests": [
    {
      "description": string,
      "host": string,
      "path": string,
      "service": string
    }
  ],
  "defaultService": string,
  "fingerprint": bytes
}
Property name Value Description Notes
creationTimestamp string [Output Only] Creation timestamp in RFC3339 text format.
defaultService string The URL of the BackendService resource if none of the hostRules match.
description string An optional description of this resource. Provide this property when you create the resource.
fingerprint bytes Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a UrlMap. An up-to-date fingerprint must be provided in order to update the UrlMap.
hostRules[] list The list of HostRules to use against the URL.
hostRules[].description string An optional description of this resource. Provide this property when you create the resource.
hostRules[].hosts[] list The list of host patterns to match. They must be valid hostnames, except * will match any string of ([a-z0-9-.]*). In that case, * must be the first character and must be followed in the pattern by either - or ..
hostRules[].pathMatcher string The name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion.
id unsigned long [Output Only] The unique identifier for the resource. This identifier is defined by the server.
kind string [Output Only] Type of the resource. Always compute#urlMaps for url maps.
name string Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
pathMatchers[] list The list of named PathMatchers to use against the URL.
pathMatchers[].defaultService string The full or partial URL to the BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. For example, the following are all valid URLs to a BackendService resource:
  • https://www.googleapis.com/compute/v1/projects/project/global/backendServices/backendService
  • compute/v1/projects/project/global/backendServices/backendService
  • global/backendServices/backendService
pathMatchers[].description string An optional description of this resource. Provide this property when you create the resource.
pathMatchers[].name string The name to which this PathMatcher is referred by the HostRule.
pathMatchers[].pathRules[] list The list of path rules.
pathMatchers[].pathRules[].paths[] list The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.
pathMatchers[].pathRules[].service string The URL of the BackendService resource if this rule is matched.
tests[] list The list of expected URL mappings. Request to update this UrlMap will succeed only if all of the test cases pass.
tests[].description string Description of this test case.
tests[].host string Host portion of the URL.
tests[].path string Path portion of the URL.
tests[].service string Expected BackendService resource the given URL should be mapped to.

Methods

The following are valid UrlMaps resource methods:

delete
Deletes the specified UrlMap resource.
get
Returns the specified UrlMap resource. Get a list of available URL maps by making a list() request.
insert
Creates a UrlMap resource in the specified project using the data included in the request.
invalidateCache
Initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap.
list
Retrieves the list of UrlMap resources available to the specified project.
patch
Updates the specified UrlMap resource with the data included in the request. This method supports patch semantics.
testIamPermissions
Returns permissions that a caller has on the specified resource.
update
Updates the specified UrlMap resource with the data included in the request.
validate
Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap.

Send feedback about...

Compute Engine