REST Resource: urlMaps

Resource: UrlMap

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

JSON representation
{
  "id": string,
  "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": string,
  "kind": string
}
Fields
id

string (fixed64 format)

[Output Only] The unique identifier for the resource. This identifier is defined by the server.

creationTimestamp

string

[Output Only] Creation timestamp in RFC3339 text format.

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.

description

string

An optional description of this resource. Provide this property when you create the resource.

hostRules[]

object

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[]

string

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.

pathMatchers[]

object

The list of named PathMatchers to use against the URL.

pathMatchers[].name

string

The name to which this PathMatcher is referred by the HostRule.

pathMatchers[].description

string

An optional description of this resource. Provide this property when you create the resource.

pathMatchers[].defaultService

string

The full or partial URL to the BackendService resource. This will be used if none of the pathRules or routeRules defined by this PathMatcher are matched. For example, the following are all valid URLs to a BackendService resource:

Use defaultService instead of defaultRouteAction when simple routing to a backend service is desired and other advanced capabilities like traffic splitting and URL rewrites are not required.

Only one of defaultService, defaultRouteAction or defaultUrlRedirect must be set.

Authorization requires one or more of the following Google IAM permissions on the specified resource defaultService:

  • compute.backendBuckets.use
  • compute.backendServices.use

pathMatchers[].pathRules[]

object

The list of path rules. Use this list instead of routeRules when routing based on simple path matching is all that's required. The order by which path rules are specified does not matter. Matches are always done on the longest-path-first basis.

For example: a pathRule with a path /a/b/c/* will match before /a/b/* irrespective of the order in which those paths appear in this list.

Only one of pathRules or routeRules must be set.

pathMatchers[].pathRules[].service

string

The URL of the backend service resource if this rule is matched.

Use service instead of routeAction when simple routing to a backend service is desired and other advanced capabilities like traffic splitting and rewrites are not required.

Only one of service, routeAction or urlRedirect should must be set.

pathMatchers[].pathRules[].paths[]

string

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.

tests[]

object

The list of expected URL mapping tests. Request to update this UrlMap will succeed only if all of the test cases pass. You can specify a maximum of 100 tests per UrlMap.

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.

defaultService

string

The URL of the backendService resource if none of the hostRules match.

Use defaultService instead of defaultRouteAction when simple routing to a backendService is desired and other advanced capabilities like traffic splitting and rewrites are not required.

Only one of defaultService, defaultRouteAction or defaultUrlRedirect should must be set.

fingerprint

string (bytes format)

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, otherwise the request will fail with error 412 conditionNotMet.

To see the latest fingerprint, make a get() request to retrieve a UrlMap.

A base64-encoded string.

kind

string

[Output Only] Type of the resource. Always compute#urlMaps for url maps.

Methods

delete

Deletes the specified UrlMap resource.

get

Returns the specified UrlMap resource.

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

Patches the specified UrlMap resource with the data included in the request.

update

Updates the specified UrlMap resource with the data included in the request.

validate

Runs static validation for the UrlMap.
Was this page helpful? Let us know how we did:

Send feedback about...

Compute Engine