--- title: Routing Rules overview: Generated documentation for Istio's traffic routing rules order: 20 layout: docs type: markdown --- ### Index * [RouteRule](#istio.proxy.v1.config.RouteRule) (message) * [MatchCondition](#istio.proxy.v1.config.MatchCondition) (message) * [DestinationWeight](#istio.proxy.v1.config.DestinationWeight) (message) * [HTTPRedirect](#istio.proxy.v1.config.HTTPRedirect) (message) * [HTTPRewrite](#istio.proxy.v1.config.HTTPRewrite) (message) * [HTTPTimeout](#istio.proxy.v1.config.HTTPTimeout) (message) * [HTTPRetry](#istio.proxy.v1.config.HTTPRetry) (message) * [HTTPFaultInjection](#istio.proxy.v1.config.HTTPFaultInjection) (message) ### RouteRule Route rule provides a custom routing policy based on the source and destination service versions and connection/request metadata. The rule must provide a set of conditions for each protocol (TCP, UDP, HTTP) that the destination service exposes on its ports. The rule applies only to the ports on the destination service for which it provides protocol-specific match condition, e.g. if the rule does not specify TCP condition, the rule does not apply to TCP traffic towards the destination service. For example, a simple rule to send 100% of incoming traffic for a "reviews" service to version "v1" can be specified as follows: destination: reviews.default.svc.cluster.local route: - tags: version: v1 weight: 100
| Field | Type | Description |
|---|---|---|
destination |
string | REQUIRED: Destination uniquely identifies the destination associated with this routing rule. This field is applicable for hostname-based resolution for HTTP traffic as well as IP-based resolution for TCP/UDP traffic. The value MUST BE a fully-qualified domain name, e.g. "my-service.default.svc.cluster.local". |
precedence |
int32 | RECOMMENDED. Precedence is used to disambiguate the order of application of rules for the same destination service. A higher number takes priority. If not specified, the value is assumed to be 0. The order of application for rules with the same precedence is unspecified. |
match |
MatchCondition | Match condtions to be satisfied for the route rule to be activated. If match is omitted, the route rule applies only to HTTP traffic. |
route[] |
repeated DestinationWeight | REQUIRED (route|redirect). A routing rule can either redirect traffic or forward traffic. The forwarding target can be one of several versions of a service (see glossary in beginning of document). Weights associated with the service version determine the proportion of traffic it receives. |
redirect |
HTTPRedirect | REQUIRED (route|redirect). A routing rule can either redirect traffic or forward traffic. The redirect primitive can be used to send a HTTP 302 redirect to a different URI or Authority. |
rewrite |
HTTPRewrite | Rewrite HTTP URIs and Authority headers. Rewrite cannot be used with Redirect primitive. Rewrite will be performed before forwarding. |
httpReqTimeout |
HTTPTimeout | Timeout policy for HTTP requests. |
httpReqRetries |
HTTPRetry | Retry policy for HTTP requests. |
httpFault |
HTTPFaultInjection | Fault injection policy to apply on HTTP traffic |
| Field | Type | Description |
|---|---|---|
source |
string | Identifies the service initiating a connection or a request by its name. If specified, name MUST BE a fully qualified domain name such as foo.bar.com |
sourceTags |
repeated map<string, string> | One or more tags that uniquely identify the source service version. In Kubernetes, tags correspond to the labels associated with pods. |
httpHeaders |
repeated map<string, StringMatch> | Set of HTTP match conditions based on HTTP/1.1, HTTP/2, GRPC request metadata, such as uri, scheme, authority. The header keys must be lowercase and use hyphen as the separator, e.g. x-request-id. Note 1: The keys uri, scheme, method, and authority correspond to URI, protocol scheme (e.g., HTTP, HTTPS), HTTP method (e.g., GET, POST), and the HTTP Host header respectively. Note 2: uri can be used to perform URL matches. For URL matches (Uri_), only prefix and exact (see StringMatch) matches are supported. For other HTTP headers, exact, prefix and ECMA style regular expression matches are supported. |
| Field | Type | Description |
|---|---|---|
exact |
string (oneof ) | exact string match |
prefix |
string (oneof ) | prefix-based match |
regex |
string (oneof ) | ECMAscript style regex-based match |
| Field | Type | Description |
|---|---|---|
simpleTimeout |
SimpleTimeoutPolicy |
| Field | Type | Description |
|---|---|---|
timeout |
Duration | REQUIRED. Timeout for a HTTP request. Includes retries as well. Default 15s. format: 1h/1m/1s/1ms. MUST BE >=1ms. It is possible to control timeout per request by supplying the timeout value via x-envoy-upstream-rq-timeout-ms HTTP header. |
| Field | Type | Description |
|---|---|---|
simpleRetry |
SimpleRetryPolicy |
| Field | Type | Description |
|---|---|---|
attempts |
int32 | REQUIRED. Number of retries for a given request. The interval between retries will be determined automatically (25ms+). Actual number of retries attempted depends on the httpReqTimeout. |
perTryTimeout |
Duration | Timeout per retry attempt for a given request. format: 1h/1m/1s/1ms. MUST BE >=1ms. |
| Field | Type | Description |
|---|---|---|
delay |
Delay | Delay requests before forwarding, emulating various failures such as network issues, overloaded upstream service, etc. |
abort |
Abort | Abort Http request attempts and return error codes back to downstream service, giving the impression that the upstream service is faulty. |
| Field | Type | Description |
|---|---|---|
percent |
float | percentage of requests to be aborted with the error code provided (0-100). |
httpStatus |
int32 | REQUIRED. HTTP status code to use to abort the Http request. |
| Field | Type | Description |
|---|---|---|
percent |
float | percentage of requests on which the delay will be injected (0-100) |
fixedDelay |
Duration | REQUIRED. Add a fixed delay before forwarding the request. Format: 1h/1m/1s/1ms. MUST be >=1ms. |