- Resource: HttpRoute
- RouteRule
- RouteMatch
- HeaderMatch
- IntegerRange
- QueryParameterMatch
- RouteAction
- Destination
- HeaderModifier
- Redirect
- ResponseCode
- FaultInjectionPolicy
- Delay
- Abort
- URLRewrite
- RetryPolicy
- RequestMirrorPolicy
- CorsPolicy
- StatefulSessionAffinityPolicy
- HttpDirectResponse
- Methods
Resource: HttpRoute
HttpRoute is the resource defining how HTTP traffic should be routed by a Mesh or Gateway resource.
JSON representation |
---|
{
"name": string,
"selfLink": string,
"description": string,
"createTime": string,
"updateTime": string,
"hostnames": [
string
],
"meshes": [
string
],
"gateways": [
string
],
"labels": {
string: string,
...
},
"rules": [
{
object ( |
Fields | |
---|---|
name |
Required. Name of the HttpRoute resource. It matches pattern |
selfLink |
Output only. Server-defined URL of this resource |
description |
Optional. A free-text description of the resource. Max length 1024 characters. |
createTime |
Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
updateTime |
Output only. The timestamp when the resource was updated. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
hostnames[] |
Required. Hostnames define a set of hosts that should match against the HTTP host header to select a HttpRoute to process the request. Hostname is the fully qualified domain name of a network host, as defined by RFC 1123 with the exception that: - IPs are not allowed. - A hostname may be prefixed with a wildcard label ( Hostname can be "precise" which is a domain name without the terminating dot of a network host (e.g. Note that as per RFC1035 and RFC1123, a label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character. No other punctuation is allowed. The routes associated with a Mesh or Gateways must have unique hostnames. If you attempt to attach multiple routes with conflicting hostnames, the configuration will be rejected. For example, while it is acceptable for routes for the hostnames |
meshes[] |
Optional. Meshes defines a list of meshes this HttpRoute is attached to, as one of the routing rules to route the requests served by the mesh. Each mesh reference should match the pattern: The attached Mesh should be of a type SIDECAR |
gateways[] |
Optional. Gateways defines a list of gateways this HttpRoute is attached to, as one of the routing rules to route the requests served by the gateway. Each gateway reference should match the pattern: |
labels |
Optional. Set of label tags associated with the HttpRoute resource. An object containing a list of |
rules[] |
Required. Rules that define how traffic is routed and handled. Rules will be matched sequentially based on the RouteMatch specified for the rule. |
RouteRule
Specifies how to match traffic and how to route traffic when traffic is matched.
JSON representation |
---|
{ "matches": [ { object ( |
Fields | |
---|---|
matches[] |
A list of matches define conditions used for matching the rule against incoming HTTP requests. Each match is independent, i.e. this rule will be matched if ANY one of the matches is satisfied. If no matches field is specified, this rule will unconditionally match traffic. If a default rule is desired to be configured, add a rule with no matches specified to the end of the rules list. |
action |
The detailed rule defining how to route matched traffic. |
RouteMatch
RouteMatch defines specifications used to match requests. If multiple match types are set, this RouteMatch will match if ALL type of matches are matched.
JSON representation |
---|
{ "ignoreCase": boolean, "headers": [ { object ( |
Fields | |
---|---|
ignoreCase |
Specifies if prefixMatch and fullPathMatch matches are case sensitive. The default value is false. |
headers[] |
Specifies a list of HTTP request headers to match against. ALL of the supplied headers must be matched. |
queryParameters[] |
Specifies a list of query parameters to match against. ALL of the query parameters must be matched. |
Union field
|
|
fullPathMatch |
The HTTP request path value should exactly match this value. Only one of fullPathMatch, prefixMatch, or regexMatch should be used. |
prefixMatch |
The HTTP request path value must begin with specified prefixMatch. prefixMatch must begin with a /. Only one of fullPathMatch, prefixMatch, or regexMatch should be used. |
regexMatch |
The HTTP request path value must satisfy the regular expression specified by regexMatch after removing any query parameters and anchor supplied with the original URL. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax Only one of fullPathMatch, prefixMatch, or regexMatch should be used. |
HeaderMatch
Specifies how to select a route rule based on HTTP request headers.
JSON representation |
---|
{ "header": string, "invertMatch": boolean, // Union field |
Fields | |
---|---|
header |
The name of the HTTP header to match against. |
invertMatch |
If specified, the match result will be inverted before checking. Default value is set to false. |
Union field
|
|
exactMatch |
The value of the header should match exactly the content of exactMatch. |
regexMatch |
The value of the header must match the regular expression specified in regexMatch. For regular expression grammar, please see: https://github.com/google/re2/wiki/Syntax |
prefixMatch |
The value of the header must start with the contents of prefixMatch. |
presentMatch |
A header with headerName must exist. The match takes place whether or not the header has a value. |
suffixMatch |
The value of the header must end with the contents of suffixMatch. |
rangeMatch |
If specified, the rule will match if the request header value is within the range. |
IntegerRange
Represents an integer value range.
JSON representation |
---|
{ "start": integer, "end": integer } |
Fields | |
---|---|
start |
Start of the range (inclusive) |
end |
End of the range (exclusive) |
QueryParameterMatch
Specifications to match a query parameter in the request.
JSON representation |
---|
{ "queryParameter": string, // Union field |
Fields | |
---|---|
queryParameter |
The name of the query parameter to match. |
Union field
|
|
exactMatch |
The value of the query parameter must exactly match the contents of exactMatch. Only one of exactMatch, regexMatch, or presentMatch must be set. |
regexMatch |
The value of the query parameter must match the regular expression specified by regexMatch. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax Only one of exactMatch, regexMatch, or presentMatch must be set. |
presentMatch |
Specifies that the QueryParameterMatcher matches if request contains query parameter, irrespective of whether the parameter has a value or not. Only one of exactMatch, regexMatch, or presentMatch must be set. |
RouteAction
The specifications for routing traffic and applying associated policies.
JSON representation |
---|
{ "destinations": [ { object ( |
Fields | |
---|---|
destinations[] |
The destination to which traffic should be forwarded. |
redirect |
If set, the request is directed as configured by this field. |
faultInjectionPolicy |
The specification for fault injection introduced into traffic to test the resiliency of clients to backend service failure. As part of fault injection, when clients send requests to a backend service, delays can be introduced on a percentage of requests before sending those requests to the backend service. Similarly requests from clients can be aborted for a percentage of requests. timeout and retryPolicy will be ignored by clients that are configured with a faultInjectionPolicy |
requestHeaderModifier |
The specification for modifying the headers of a matching request prior to delivery of the request to the destination. If HeaderModifiers are set on both the Destination and the RouteAction, they will be merged. Conflicts between the two will not be resolved on the configuration. |
responseHeaderModifier |
The specification for modifying the headers of a response prior to sending the response back to the client. If HeaderModifiers are set on both the Destination and the RouteAction, they will be merged. Conflicts between the two will not be resolved on the configuration. |
urlRewrite |
The specification for rewrite URL before forwarding requests to the destination. |
timeout |
Specifies the timeout for selected route. Timeout is computed from the time the request has been fully processed (i.e. end of stream) up until the response has been completely processed. Timeout includes all retries. A duration in seconds with up to nine fractional digits, ending with ' |
retryPolicy |
Specifies the retry policy associated with this route. |
requestMirrorPolicy |
Specifies the policy on how requests intended for the routes destination are shadowed to a separate mirrored destination. Proxy will not wait for the shadow destination to respond before returning the response. Prior to sending traffic to the shadow service, the host/authority header is suffixed with -shadow. |
corsPolicy |
The specification for allowing client side cross-origin requests. |
statefulSessionAffinity |
Optional. Specifies cookie-based stateful session affinity. |
directResponse |
Optional. Static HTTP Response object to be returned regardless of the request. |
idleTimeout |
Optional. Specifies the idle timeout for the selected route. The idle timeout is defined as the period in which there are no bytes sent or received on either the upstream or downstream connection. If not set, the default idle timeout is 1 hour. If set to 0s, the timeout will be disabled. A duration in seconds with up to nine fractional digits, ending with ' |
Destination
Specifications of a destination to which the request should be routed to.
JSON representation |
---|
{ "serviceName": string, "weight": integer, "requestHeaderModifier": { object ( |
Fields | |
---|---|
serviceName |
The URL of a BackendService to route traffic to. |
weight |
Specifies the proportion of requests forwarded to the backend referenced by the serviceName field. This is computed as: - weight/Sum(weights in this destination list). For non-zero values, there may be some epsilon from the exact proportion defined here depending on the precision an implementation supports. If only one serviceName is specified and it has a weight greater than 0, 100% of the traffic is forwarded to that backend. If weights are specified for any one service name, they need to be specified for all of them. If weights are unspecified for all services, then, traffic is distributed in equal proportions to all of them. |
requestHeaderModifier |
Optional. The specification for modifying the headers of a matching request prior to delivery of the request to the destination. If HeaderModifiers are set on both the Destination and the RouteAction, they will be merged. Conflicts between the two will not be resolved on the configuration. |
responseHeaderModifier |
Optional. The specification for modifying the headers of a response prior to sending the response back to the client. If HeaderModifiers are set on both the Destination and the RouteAction, they will be merged. Conflicts between the two will not be resolved on the configuration. |
HeaderModifier
The specification for modifying HTTP header in HTTP request and HTTP response.
JSON representation |
---|
{ "set": { string: string, ... }, "add": { string: string, ... }, "remove": [ string ] } |
Fields | |
---|---|
set |
Completely overwrite/replace the headers with given map where key is the name of the header, value is the value of the header. An object containing a list of |
add |
Add the headers with given map where key is the name of the header, value is the value of the header. An object containing a list of |
remove[] |
Remove headers (matching by header names) specified in the list. |
Redirect
The specification for redirecting traffic.
JSON representation |
---|
{
"hostRedirect": string,
"pathRedirect": string,
"prefixRewrite": string,
"responseCode": enum ( |
Fields | |
---|---|
hostRedirect |
The host that will be used in the redirect response instead of the one that was supplied in the request. |
pathRedirect |
The path that will be used in the redirect response instead of the one that was supplied in the request. pathRedirect can not be supplied together with prefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request will be used for the redirect. |
prefixRewrite |
Indicates that during redirection, the matched prefix (or path) should be swapped with this value. This option allows URLs be dynamically created based on the request. |
responseCode |
The HTTP Status code to use for the redirect. |
httpsRedirect |
If set to true, the URL scheme in the redirected request is set to https. If set to false, the URL scheme of the redirected request will remain the same as that of the request. The default is set to false. |
stripQuery |
if set to true, any accompanying query portion of the original URL is removed prior to redirecting the request. If set to false, the query portion of the original URL is retained. The default is set to false. |
portRedirect |
The port that will be used in the redirected request instead of the one that was supplied in the request. |
ResponseCode
Supported HTTP response code.
Enums | |
---|---|
RESPONSE_CODE_UNSPECIFIED |
Default value |
MOVED_PERMANENTLY_DEFAULT |
Corresponds to 301. |
FOUND |
Corresponds to 302. |
SEE_OTHER |
Corresponds to 303. |
TEMPORARY_REDIRECT |
Corresponds to 307. In this case, the request method will be retained. |
PERMANENT_REDIRECT |
Corresponds to 308. In this case, the request method will be retained. |
FaultInjectionPolicy
The specification for fault injection introduced into traffic to test the resiliency of clients to destination service failure. As part of fault injection, when clients send requests to a destination, delays can be introduced by client proxy on a percentage of requests before sending those requests to the destination service. Similarly requests can be aborted by client proxy for a percentage of requests.
JSON representation |
---|
{ "delay": { object ( |
Fields | |
---|---|
delay |
The specification for injecting delay to client requests. |
abort |
The specification for aborting to client requests. |
Delay
Specification of how client requests are delayed as part of fault injection before being sent to a destination.
JSON representation |
---|
{ "fixedDelay": string, "percentage": integer } |
Fields | |
---|---|
fixedDelay |
Specify a fixed delay before forwarding the request. A duration in seconds with up to nine fractional digits, ending with ' |
percentage |
The percentage of traffic on which delay will be injected. The value must be between [0, 100] |
Abort
Specification of how client requests are aborted as part of fault injection before being sent to a destination.
JSON representation |
---|
{ "httpStatus": integer, "percentage": integer } |
Fields | |
---|---|
httpStatus |
The HTTP status code used to abort the request. The value must be between 200 and 599 inclusive. |
percentage |
The percentage of traffic which will be aborted. The value must be between [0, 100] |
URLRewrite
The specification for modifying the URL of the request, prior to forwarding the request to the destination.
JSON representation |
---|
{ "pathPrefixRewrite": string, "hostRewrite": string } |
Fields | |
---|---|
pathPrefixRewrite |
Prior to forwarding the request to the selected destination, the matching portion of the requests path is replaced by this value. |
hostRewrite |
Prior to forwarding the request to the selected destination, the requests host header is replaced by this value. |
RetryPolicy
The specifications for retries.
JSON representation |
---|
{ "retryConditions": [ string ], "numRetries": integer, "perTryTimeout": string } |
Fields | |
---|---|
retryConditions[] |
Specifies one or more conditions when this retry policy applies. Valid values are: 5xx: Proxy will attempt a retry if the destination service responds with any 5xx response code, of if the destination service does not respond at all, example: disconnect, reset, read timeout, connection failure and refused streams. gateway-error: Similar to 5xx, but only applies to response codes 502, 503, 504. reset: Proxy will attempt a retry if the destination service does not respond at all (disconnect/reset/read timeout) connect-failure: Proxy will retry on failures connecting to destination for example due to connection timeouts. retriable-4xx: Proxy will retry fro retriable 4xx response codes. Currently the only retriable error supported is 409. refused-stream: Proxy will retry if the destination resets the stream with a REFUSED_STREAM error code. This reset type indicates that it is safe to retry. |
numRetries |
Specifies the allowed number of retries. This number must be > 0. If not specified, default to 1. |
perTryTimeout |
Specifies a non-zero timeout per retry attempt. A duration in seconds with up to nine fractional digits, ending with ' |
RequestMirrorPolicy
Specifies the policy on how requests are shadowed to a separate mirrored destination service. The proxy does not wait for responses from the shadow service. Prior to sending traffic to the shadow service, the host/authority header is suffixed with -shadow.
JSON representation |
---|
{
"destination": {
object ( |
Fields | |
---|---|
destination |
The destination the requests will be mirrored to. The weight of the destination will be ignored. |
mirrorPercent |
Optional. The percentage of requests to get mirrored to the desired destination. |
CorsPolicy
The Specification for allowing client side cross-origin requests.
JSON representation |
---|
{ "allowOrigins": [ string ], "allowOriginRegexes": [ string ], "allowMethods": [ string ], "allowHeaders": [ string ], "exposeHeaders": [ string ], "maxAge": string, "allowCredentials": boolean, "disabled": boolean } |
Fields | |
---|---|
allowOrigins[] |
Specifies the list of origins that will be allowed to do CORS requests. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes. |
allowOriginRegexes[] |
Specifies the regular expression patterns that match allowed origins. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax. |
allowMethods[] |
Specifies the content for Access-Control-Allow-Methods header. |
allowHeaders[] |
Specifies the content for Access-Control-Allow-Headers header. |
exposeHeaders[] |
Specifies the content for Access-Control-Expose-Headers header. |
maxAge |
Specifies how long result of a preflight request can be cached in seconds. This translates to the Access-Control-Max-Age header. |
allowCredentials |
In response to a preflight request, setting this to true indicates that the actual request can include user credentials. This translates to the Access-Control-Allow-Credentials header. Default value is false. |
disabled |
If true, the CORS policy is disabled. The default value is false, which indicates that the CORS policy is in effect. |
StatefulSessionAffinityPolicy
The specification for cookie-based stateful session affinity where the date plane supplies a “session cookie” with the name "GSSA" which encodes a specific destination host and each request containing that cookie will be directed to that host as long as the destination host remains up and healthy.
The gRPC proxyless mesh library or sidecar proxy will manage the session cookie but the client application code is responsible for copying the cookie from each RPC in the session to the next.
JSON representation |
---|
{ "cookieTtl": string } |
Fields | |
---|---|
cookieTtl |
Required. The cookie TTL value for the Set-Cookie header generated by the data plane. The lifetime of the cookie may be set to a value from 1 to 86400 seconds (24 hours) inclusive. A duration in seconds with up to nine fractional digits, ending with ' |
HttpDirectResponse
Static HTTP response object to be returned.
JSON representation |
---|
{ "status": integer, // Union field |
Fields | |
---|---|
status |
Required. Status to return as part of HTTP Response. Must be a positive integer. |
Union field HttpBody . Body to return as part of HTTP Response. HttpBody can be only one of the following: |
|
stringBody |
Optional. Response body as a string. Maximum body length is 1024 characters. |
bytesBody |
Optional. Response body as bytes. Maximum body size is 4096B. A base64-encoded string. |
Methods |
|
---|---|
|
Creates a new HttpRoute in a given project and location. |
|
Deletes a single HttpRoute. |
|
Gets details of a single HttpRoute. |
|
Lists HttpRoute in a given project and location. |
|
Updates the parameters of a single HttpRoute. |
|
Sets the access control policy on the specified resource. |
|
Returns permissions that a caller has on the specified resource. |