1syntax = "proto3"; 2 3package envoy.config.route.v3; 4 5import "envoy/config/core/v3/base.proto"; 6import "envoy/config/core/v3/extension.proto"; 7import "envoy/config/core/v3/proxy_protocol.proto"; 8import "envoy/type/matcher/v3/metadata.proto"; 9import "envoy/type/matcher/v3/regex.proto"; 10import "envoy/type/matcher/v3/string.proto"; 11import "envoy/type/metadata/v3/metadata.proto"; 12import "envoy/type/tracing/v3/custom_tag.proto"; 13import "envoy/type/v3/percent.proto"; 14import "envoy/type/v3/range.proto"; 15 16import "google/protobuf/any.proto"; 17import "google/protobuf/duration.proto"; 18import "google/protobuf/wrappers.proto"; 19 20import "xds/annotations/v3/status.proto"; 21import "xds/type/matcher/v3/matcher.proto"; 22 23import "envoy/annotations/deprecation.proto"; 24import "udpa/annotations/migrate.proto"; 25import "udpa/annotations/status.proto"; 26import "udpa/annotations/versioning.proto"; 27import "validate/validate.proto"; 28 29option java_package = "io.envoyproxy.envoy.config.route.v3"; 30option java_outer_classname = "RouteComponentsProto"; 31option java_multiple_files = true; 32option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/route/v3;routev3"; 33option (udpa.annotations.file_status).package_version_status = ACTIVE; 34 35// [#protodoc-title: HTTP route components] 36// * Routing :ref:`architecture overview <arch_overview_http_routing>` 37// * HTTP :ref:`router filter <config_http_filters_router>` 38 39// The top level element in the routing configuration is a virtual host. Each virtual host has 40// a logical name as well as a set of domains that get routed to it based on the incoming request's 41// host header. This allows a single listener to service multiple top level domain path trees. Once 42// a virtual host is selected based on the domain, the routes are processed in order to see which 43// upstream cluster to route to or whether to perform a redirect. 44// [#next-free-field: 24] 45message VirtualHost { 46 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.VirtualHost"; 47 48 enum TlsRequirementType { 49 // No TLS requirement for the virtual host. 50 NONE = 0; 51 52 // External requests must use TLS. If a request is external and it is not 53 // using TLS, a 301 redirect will be sent telling the client to use HTTPS. 54 EXTERNAL_ONLY = 1; 55 56 // All requests must use TLS. If a request is not using TLS, a 301 redirect 57 // will be sent telling the client to use HTTPS. 58 ALL = 2; 59 } 60 61 reserved 9, 12; 62 63 reserved "per_filter_config"; 64 65 // The logical name of the virtual host. This is used when emitting certain 66 // statistics but is not relevant for routing. 67 string name = 1 [(validate.rules).string = {min_len: 1}]; 68 69 // A list of domains (host/authority header) that will be matched to this 70 // virtual host. Wildcard hosts are supported in the suffix or prefix form. 71 // 72 // Domain search order: 73 // 1. Exact domain names: ``www.foo.com``. 74 // 2. Suffix domain wildcards: ``*.foo.com`` or ``*-bar.foo.com``. 75 // 3. Prefix domain wildcards: ``foo.*`` or ``foo-*``. 76 // 4. Special wildcard ``*`` matching any domain. 77 // 78 // .. note:: 79 // 80 // The wildcard will not match the empty string. 81 // e.g. ``*-bar.foo.com`` will match ``baz-bar.foo.com`` but not ``-bar.foo.com``. 82 // The longest wildcards match first. 83 // Only a single virtual host in the entire route configuration can match on ``*``. A domain 84 // must be unique across all virtual hosts or the config will fail to load. 85 // 86 // Domains cannot contain control characters. This is validated by the well_known_regex HTTP_HEADER_VALUE. 87 repeated string domains = 2 [(validate.rules).repeated = { 88 min_items: 1 89 items {string {well_known_regex: HTTP_HEADER_VALUE strict: false}} 90 }]; 91 92 // The list of routes that will be matched, in order, for incoming requests. 93 // The first route that matches will be used. 94 // Only one of this and ``matcher`` can be specified. 95 repeated Route routes = 3; 96 97 // [#next-major-version: This should be included in a oneof with routes wrapped in a message.] 98 // The match tree to use when resolving route actions for incoming requests. Only one of this and ``routes`` 99 // can be specified. 100 xds.type.matcher.v3.Matcher matcher = 21 101 [(xds.annotations.v3.field_status).work_in_progress = true]; 102 103 // Specifies the type of TLS enforcement the virtual host expects. If this option is not 104 // specified, there is no TLS requirement for the virtual host. 105 TlsRequirementType require_tls = 4 [(validate.rules).enum = {defined_only: true}]; 106 107 // A list of virtual clusters defined for this virtual host. Virtual clusters 108 // are used for additional statistics gathering. 109 repeated VirtualCluster virtual_clusters = 5; 110 111 // Specifies a set of rate limit configurations that will be applied to the 112 // virtual host. 113 repeated RateLimit rate_limits = 6; 114 115 // Specifies a list of HTTP headers that should be added to each request 116 // handled by this virtual host. Headers specified at this level are applied 117 // after headers from enclosed :ref:`envoy_v3_api_msg_config.route.v3.Route` and before headers from the 118 // enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including 119 // details on header value syntax, see the documentation on :ref:`custom request headers 120 // <config_http_conn_man_headers_custom_request_headers>`. 121 repeated core.v3.HeaderValueOption request_headers_to_add = 7 122 [(validate.rules).repeated = {max_items: 1000}]; 123 124 // Specifies a list of HTTP headers that should be removed from each request 125 // handled by this virtual host. 126 repeated string request_headers_to_remove = 13 [(validate.rules).repeated = { 127 items {string {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}} 128 }]; 129 130 // Specifies a list of HTTP headers that should be added to each response 131 // handled by this virtual host. Headers specified at this level are applied 132 // after headers from enclosed :ref:`envoy_v3_api_msg_config.route.v3.Route` and before headers from the 133 // enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including 134 // details on header value syntax, see the documentation on :ref:`custom request headers 135 // <config_http_conn_man_headers_custom_request_headers>`. 136 repeated core.v3.HeaderValueOption response_headers_to_add = 10 137 [(validate.rules).repeated = {max_items: 1000}]; 138 139 // Specifies a list of HTTP headers that should be removed from each response 140 // handled by this virtual host. 141 repeated string response_headers_to_remove = 11 [(validate.rules).repeated = { 142 items {string {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}} 143 }]; 144 145 // Indicates that the virtual host has a CORS policy. This field is ignored if related cors policy is 146 // found in the 147 // :ref:`VirtualHost.typed_per_filter_config<envoy_v3_api_field_config.route.v3.VirtualHost.typed_per_filter_config>`. 148 // 149 // .. attention:: 150 // 151 // This option has been deprecated. Please use 152 // :ref:`VirtualHost.typed_per_filter_config<envoy_v3_api_field_config.route.v3.VirtualHost.typed_per_filter_config>` 153 // to configure the CORS HTTP filter. 154 CorsPolicy cors = 8 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 155 156 // The per_filter_config field can be used to provide virtual host-specific configurations for filters. 157 // The key should match the :ref:`filter config name 158 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpFilter.name>`. 159 // The canonical filter name (e.g., ``envoy.filters.http.buffer`` for the HTTP buffer filter) can also 160 // be used for the backwards compatibility. If there is no entry referred by the filter config name, the 161 // entry referred by the canonical filter name will be provided to the filters as fallback. 162 // 163 // Use of this field is filter specific; 164 // see the :ref:`HTTP filter documentation <config_http_filters>` for if and how it is utilized. 165 // [#comment: An entry's value may be wrapped in a 166 // :ref:`FilterConfig<envoy_v3_api_msg_config.route.v3.FilterConfig>` 167 // message to specify additional options.] 168 map<string, google.protobuf.Any> typed_per_filter_config = 15; 169 170 // Decides whether the :ref:`x-envoy-attempt-count 171 // <config_http_filters_router_x-envoy-attempt-count>` header should be included 172 // in the upstream request. Setting this option will cause it to override any existing header 173 // value, so in the case of two Envoys on the request path with this option enabled, the upstream 174 // will see the attempt count as perceived by the second Envoy. Defaults to false. 175 // This header is unaffected by the 176 // :ref:`suppress_envoy_headers 177 // <envoy_v3_api_field_extensions.filters.http.router.v3.Router.suppress_envoy_headers>` flag. 178 // 179 // [#next-major-version: rename to include_attempt_count_in_request.] 180 bool include_request_attempt_count = 14; 181 182 // Decides whether the :ref:`x-envoy-attempt-count 183 // <config_http_filters_router_x-envoy-attempt-count>` header should be included 184 // in the downstream response. Setting this option will cause the router to override any existing header 185 // value, so in the case of two Envoys on the request path with this option enabled, the downstream 186 // will see the attempt count as perceived by the Envoy closest upstream from itself. Defaults to false. 187 // This header is unaffected by the 188 // :ref:`suppress_envoy_headers 189 // <envoy_v3_api_field_extensions.filters.http.router.v3.Router.suppress_envoy_headers>` flag. 190 bool include_attempt_count_in_response = 19; 191 192 // Indicates the retry policy for all routes in this virtual host. Note that setting a 193 // route level entry will take precedence over this config and it'll be treated 194 // independently (e.g.: values are not inherited). 195 RetryPolicy retry_policy = 16; 196 197 // [#not-implemented-hide:] 198 // Specifies the configuration for retry policy extension. Note that setting a route level entry 199 // will take precedence over this config and it'll be treated independently (e.g.: values are not 200 // inherited). :ref:`Retry policy <envoy_v3_api_field_config.route.v3.VirtualHost.retry_policy>` should not be 201 // set if this field is used. 202 google.protobuf.Any retry_policy_typed_config = 20; 203 204 // Indicates the hedge policy for all routes in this virtual host. Note that setting a 205 // route level entry will take precedence over this config and it'll be treated 206 // independently (e.g.: values are not inherited). 207 HedgePolicy hedge_policy = 17; 208 209 // Decides whether to include the :ref:`x-envoy-is-timeout-retry <config_http_filters_router_x-envoy-is-timeout-retry>` 210 // request header in retries initiated by per try timeouts. 211 bool include_is_timeout_retry_header = 23; 212 213 // The maximum bytes which will be buffered for retries and shadowing. 214 // If set and a route-specific limit is not set, the bytes actually buffered will be the minimum 215 // value of this and the listener per_connection_buffer_limit_bytes. 216 google.protobuf.UInt32Value per_request_buffer_limit_bytes = 18; 217 218 // Specify a set of default request mirroring policies for every route under this virtual host. 219 // It takes precedence over the route config mirror policy entirely. 220 // That is, policies are not merged, the most specific non-empty one becomes the mirror policies. 221 repeated RouteAction.RequestMirrorPolicy request_mirror_policies = 22; 222} 223 224// A filter-defined action type. 225message FilterAction { 226 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.FilterAction"; 227 228 google.protobuf.Any action = 1; 229} 230 231// This can be used in route matcher :ref:`VirtualHost.matcher <envoy_v3_api_field_config.route.v3.VirtualHost.matcher>`. 232// When the matcher matches, routes will be matched and run. 233message RouteList { 234 // The list of routes that will be matched and run, in order. The first route that matches will be used. 235 repeated Route routes = 1; 236} 237 238// A route is both a specification of how to match a request as well as an indication of what to do 239// next (e.g., redirect, forward, rewrite, etc.). 240// 241// .. attention:: 242// 243// Envoy supports routing on HTTP method via :ref:`header matching 244// <envoy_v3_api_msg_config.route.v3.HeaderMatcher>`. 245// [#next-free-field: 20] 246message Route { 247 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.Route"; 248 249 reserved 6, 8; 250 251 reserved "per_filter_config"; 252 253 // Name for the route. 254 string name = 14; 255 256 // Route matching parameters. 257 RouteMatch match = 1 [(validate.rules).message = {required: true}]; 258 259 oneof action { 260 option (validate.required) = true; 261 262 // Route request to some upstream cluster. 263 RouteAction route = 2; 264 265 // Return a redirect. 266 RedirectAction redirect = 3; 267 268 // Return an arbitrary HTTP response directly, without proxying. 269 DirectResponseAction direct_response = 7; 270 271 // [#not-implemented-hide:] 272 // A filter-defined action (e.g., it could dynamically generate the RouteAction). 273 // [#comment: TODO(samflattery): Remove cleanup in route_fuzz_test.cc when 274 // implemented] 275 FilterAction filter_action = 17; 276 277 // [#not-implemented-hide:] 278 // An action used when the route will generate a response directly, 279 // without forwarding to an upstream host. This will be used in non-proxy 280 // xDS clients like the gRPC server. It could also be used in the future 281 // in Envoy for a filter that directly generates responses for requests. 282 NonForwardingAction non_forwarding_action = 18; 283 } 284 285 // The Metadata field can be used to provide additional information 286 // about the route. It can be used for configuration, stats, and logging. 287 // The metadata should go under the filter namespace that will need it. 288 // For instance, if the metadata is intended for the Router filter, 289 // the filter name should be specified as ``envoy.filters.http.router``. 290 core.v3.Metadata metadata = 4; 291 292 // Decorator for the matched route. 293 Decorator decorator = 5; 294 295 // The per_filter_config field can be used to provide route-specific configurations for filters. 296 // The key should match the :ref:`filter config name 297 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpFilter.name>`. 298 // The canonical filter name (e.g., ``envoy.filters.http.buffer`` for the HTTP buffer filter) can also 299 // be used for the backwards compatibility. If there is no entry referred by the filter config name, the 300 // entry referred by the canonical filter name will be provided to the filters as fallback. 301 // 302 // Use of this field is filter specific; 303 // see the :ref:`HTTP filter documentation <config_http_filters>` for if and how it is utilized. 304 // [#comment: An entry's value may be wrapped in a 305 // :ref:`FilterConfig<envoy_v3_api_msg_config.route.v3.FilterConfig>` 306 // message to specify additional options.] 307 map<string, google.protobuf.Any> typed_per_filter_config = 13; 308 309 // Specifies a set of headers that will be added to requests matching this 310 // route. Headers specified at this level are applied before headers from the 311 // enclosing :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost` and 312 // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including details on 313 // header value syntax, see the documentation on :ref:`custom request headers 314 // <config_http_conn_man_headers_custom_request_headers>`. 315 repeated core.v3.HeaderValueOption request_headers_to_add = 9 316 [(validate.rules).repeated = {max_items: 1000}]; 317 318 // Specifies a list of HTTP headers that should be removed from each request 319 // matching this route. 320 repeated string request_headers_to_remove = 12 [(validate.rules).repeated = { 321 items {string {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}} 322 }]; 323 324 // Specifies a set of headers that will be added to responses to requests 325 // matching this route. Headers specified at this level are applied before 326 // headers from the enclosing :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost` and 327 // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including 328 // details on header value syntax, see the documentation on 329 // :ref:`custom request headers <config_http_conn_man_headers_custom_request_headers>`. 330 repeated core.v3.HeaderValueOption response_headers_to_add = 10 331 [(validate.rules).repeated = {max_items: 1000}]; 332 333 // Specifies a list of HTTP headers that should be removed from each response 334 // to requests matching this route. 335 repeated string response_headers_to_remove = 11 [(validate.rules).repeated = { 336 items {string {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}} 337 }]; 338 339 // Presence of the object defines whether the connection manager's tracing configuration 340 // is overridden by this route specific instance. 341 Tracing tracing = 15; 342 343 // The maximum bytes which will be buffered for retries and shadowing. 344 // If set, the bytes actually buffered will be the minimum value of this and the 345 // listener per_connection_buffer_limit_bytes. 346 google.protobuf.UInt32Value per_request_buffer_limit_bytes = 16; 347 348 // The human readable prefix to use when emitting statistics for this endpoint. 349 // The statistics are rooted at vhost.<virtual host name>.route.<stat_prefix>. 350 // This should be set for highly critical 351 // endpoints that one wishes to get “per-route” statistics on. 352 // If not set, endpoint statistics are not generated. 353 // 354 // The emitted statistics are the same as those documented for :ref:`virtual clusters <config_http_filters_router_vcluster_stats>`. 355 // 356 // .. warning:: 357 // 358 // We do not recommend setting up a stat prefix for 359 // every application endpoint. This is both not easily maintainable and 360 // statistics use a non-trivial amount of memory(approximately 1KiB per route). 361 string stat_prefix = 19; 362} 363 364// Compared to the :ref:`cluster <envoy_v3_api_field_config.route.v3.RouteAction.cluster>` field that specifies a 365// single upstream cluster as the target of a request, the :ref:`weighted_clusters 366// <envoy_v3_api_field_config.route.v3.RouteAction.weighted_clusters>` option allows for specification of 367// multiple upstream clusters along with weights that indicate the percentage of 368// traffic to be forwarded to each cluster. The router selects an upstream cluster based on the 369// weights. 370message WeightedCluster { 371 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.WeightedCluster"; 372 373 // [#next-free-field: 13] 374 message ClusterWeight { 375 option (udpa.annotations.versioning).previous_message_type = 376 "envoy.api.v2.route.WeightedCluster.ClusterWeight"; 377 378 reserved 7, 8; 379 380 reserved "per_filter_config"; 381 382 // Only one of ``name`` and ``cluster_header`` may be specified. 383 // [#next-major-version: Need to add back the validation rule: (validate.rules).string = {min_len: 1}] 384 // Name of the upstream cluster. The cluster must exist in the 385 // :ref:`cluster manager configuration <config_cluster_manager>`. 386 string name = 1 [(udpa.annotations.field_migrate).oneof_promotion = "cluster_specifier"]; 387 388 // Only one of ``name`` and ``cluster_header`` may be specified. 389 // [#next-major-version: Need to add back the validation rule: (validate.rules).string = {min_len: 1 }] 390 // Envoy will determine the cluster to route to by reading the value of the 391 // HTTP header named by cluster_header from the request headers. If the 392 // header is not found or the referenced cluster does not exist, Envoy will 393 // return a 404 response. 394 // 395 // .. attention:: 396 // 397 // Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 398 // ``Host`` header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. 399 // 400 // .. note:: 401 // 402 // If the header appears multiple times only the first value is used. 403 string cluster_header = 12 [ 404 (validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}, 405 (udpa.annotations.field_migrate).oneof_promotion = "cluster_specifier" 406 ]; 407 408 // The weight of the cluster. This value is relative to the other clusters' 409 // weights. When a request matches the route, the choice of an upstream cluster 410 // is determined by its weight. The sum of weights across all 411 // entries in the clusters array must be greater than 0, and must not exceed 412 // uint32_t maximal value (4294967295). 413 google.protobuf.UInt32Value weight = 2; 414 415 // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints in 416 // the upstream cluster with metadata matching what is set in this field will be considered for 417 // load balancing. Note that this will be merged with what's provided in 418 // :ref:`RouteAction.metadata_match <envoy_v3_api_field_config.route.v3.RouteAction.metadata_match>`, with 419 // values here taking precedence. The filter name should be specified as ``envoy.lb``. 420 core.v3.Metadata metadata_match = 3; 421 422 // Specifies a list of headers to be added to requests when this cluster is selected 423 // through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. 424 // Headers specified at this level are applied before headers from the enclosing 425 // :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`, and 426 // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including details on 427 // header value syntax, see the documentation on :ref:`custom request headers 428 // <config_http_conn_man_headers_custom_request_headers>`. 429 repeated core.v3.HeaderValueOption request_headers_to_add = 4 430 [(validate.rules).repeated = {max_items: 1000}]; 431 432 // Specifies a list of HTTP headers that should be removed from each request when 433 // this cluster is selected through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. 434 repeated string request_headers_to_remove = 9 [(validate.rules).repeated = { 435 items {string {well_known_regex: HTTP_HEADER_NAME strict: false}} 436 }]; 437 438 // Specifies a list of headers to be added to responses when this cluster is selected 439 // through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. 440 // Headers specified at this level are applied before headers from the enclosing 441 // :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`, and 442 // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including details on 443 // header value syntax, see the documentation on :ref:`custom request headers 444 // <config_http_conn_man_headers_custom_request_headers>`. 445 repeated core.v3.HeaderValueOption response_headers_to_add = 5 446 [(validate.rules).repeated = {max_items: 1000}]; 447 448 // Specifies a list of headers to be removed from responses when this cluster is selected 449 // through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. 450 repeated string response_headers_to_remove = 6 [(validate.rules).repeated = { 451 items {string {well_known_regex: HTTP_HEADER_NAME strict: false}} 452 }]; 453 454 // The per_filter_config field can be used to provide weighted cluster-specific configurations 455 // for filters. 456 // The key should match the :ref:`filter config name 457 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpFilter.name>`. 458 // The canonical filter name (e.g., ``envoy.filters.http.buffer`` for the HTTP buffer filter) can also 459 // be used for the backwards compatibility. If there is no entry referred by the filter config name, the 460 // entry referred by the canonical filter name will be provided to the filters as fallback. 461 // 462 // Use of this field is filter specific; 463 // see the :ref:`HTTP filter documentation <config_http_filters>` for if and how it is utilized. 464 // [#comment: An entry's value may be wrapped in a 465 // :ref:`FilterConfig<envoy_v3_api_msg_config.route.v3.FilterConfig>` 466 // message to specify additional options.] 467 map<string, google.protobuf.Any> typed_per_filter_config = 10; 468 469 oneof host_rewrite_specifier { 470 // Indicates that during forwarding, the host header will be swapped with 471 // this value. 472 string host_rewrite_literal = 11 473 [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; 474 } 475 } 476 477 // Specifies one or more upstream clusters associated with the route. 478 repeated ClusterWeight clusters = 1 [(validate.rules).repeated = {min_items: 1}]; 479 480 // Specifies the total weight across all clusters. The sum of all cluster weights must equal this 481 // value, if this is greater than 0. 482 // This field is now deprecated, and the client will use the sum of all 483 // cluster weights. It is up to the management server to supply the correct weights. 484 google.protobuf.UInt32Value total_weight = 3 485 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 486 487 // Specifies the runtime key prefix that should be used to construct the 488 // runtime keys associated with each cluster. When the ``runtime_key_prefix`` is 489 // specified, the router will look for weights associated with each upstream 490 // cluster under the key ``runtime_key_prefix`` + ``.`` + ``cluster[i].name`` where 491 // ``cluster[i]`` denotes an entry in the clusters array field. If the runtime 492 // key for the cluster does not exist, the value specified in the 493 // configuration file will be used as the default weight. See the :ref:`runtime documentation 494 // <operations_runtime>` for how key names map to the underlying implementation. 495 string runtime_key_prefix = 2; 496 497 oneof random_value_specifier { 498 // Specifies the header name that is used to look up the random value passed in the request header. 499 // This is used to ensure consistent cluster picking across multiple proxy levels for weighted traffic. 500 // If header is not present or invalid, Envoy will fall back to use the internally generated random value. 501 // This header is expected to be single-valued header as we only want to have one selected value throughout 502 // the process for the consistency. And the value is a unsigned number between 0 and UINT64_MAX. 503 string header_name = 4 504 [(validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}]; 505 } 506} 507 508// Configuration for a cluster specifier plugin. 509message ClusterSpecifierPlugin { 510 // The name of the plugin and its opaque configuration. 511 core.v3.TypedExtensionConfig extension = 1 [(validate.rules).message = {required: true}]; 512 513 // If is_optional is not set or is set to false and the plugin defined by this message is not a 514 // supported type, the containing resource is NACKed. If is_optional is set to true, the resource 515 // would not be NACKed for this reason. In this case, routes referencing this plugin's name would 516 // not be treated as an illegal configuration, but would result in a failure if the route is 517 // selected. 518 bool is_optional = 2; 519} 520 521// [#next-free-field: 16] 522message RouteMatch { 523 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.RouteMatch"; 524 525 message GrpcRouteMatchOptions { 526 option (udpa.annotations.versioning).previous_message_type = 527 "envoy.api.v2.route.RouteMatch.GrpcRouteMatchOptions"; 528 } 529 530 message TlsContextMatchOptions { 531 option (udpa.annotations.versioning).previous_message_type = 532 "envoy.api.v2.route.RouteMatch.TlsContextMatchOptions"; 533 534 // If specified, the route will match against whether or not a certificate is presented. 535 // If not specified, certificate presentation status (true or false) will not be considered when route matching. 536 google.protobuf.BoolValue presented = 1; 537 538 // If specified, the route will match against whether or not a certificate is validated. 539 // If not specified, certificate validation status (true or false) will not be considered when route matching. 540 google.protobuf.BoolValue validated = 2; 541 } 542 543 // An extensible message for matching CONNECT requests. 544 message ConnectMatcher { 545 } 546 547 reserved 5, 3; 548 549 reserved "regex"; 550 551 oneof path_specifier { 552 option (validate.required) = true; 553 554 // If specified, the route is a prefix rule meaning that the prefix must 555 // match the beginning of the ``:path`` header. 556 string prefix = 1; 557 558 // If specified, the route is an exact path rule meaning that the path must 559 // exactly match the ``:path`` header once the query string is removed. 560 string path = 2; 561 562 // If specified, the route is a regular expression rule meaning that the 563 // regex must match the ``:path`` header once the query string is removed. The entire path 564 // (without the query string) must match the regex. The rule will not match if only a 565 // subsequence of the ``:path`` header matches the regex. 566 // 567 // [#next-major-version: In the v3 API we should redo how path specification works such 568 // that we utilize StringMatcher, and additionally have consistent options around whether we 569 // strip query strings, do a case sensitive match, etc. In the interim it will be too disruptive 570 // to deprecate the existing options. We should even consider whether we want to do away with 571 // path_specifier entirely and just rely on a set of header matchers which can already match 572 // on :path, etc. The issue with that is it is unclear how to generically deal with query string 573 // stripping. This needs more thought.] 574 type.matcher.v3.RegexMatcher safe_regex = 10 [(validate.rules).message = {required: true}]; 575 576 // If this is used as the matcher, the matcher will only match CONNECT requests. 577 // Note that this will not match HTTP/2 upgrade-style CONNECT requests 578 // (WebSocket and the like) as they are normalized in Envoy as HTTP/1.1 style 579 // upgrades. 580 // This is the only way to match CONNECT requests for HTTP/1.1. For HTTP/2, 581 // where Extended CONNECT requests may have a path, the path matchers will work if 582 // there is a path present. 583 // Note that CONNECT support is currently considered alpha in Envoy. 584 // [#comment: TODO(htuch): Replace the above comment with an alpha tag.] 585 ConnectMatcher connect_matcher = 12; 586 587 // If specified, the route is a path-separated prefix rule meaning that the 588 // ``:path`` header (without the query string) must either exactly match the 589 // ``path_separated_prefix`` or have it as a prefix, followed by ``/`` 590 // 591 // For example, ``/api/dev`` would match 592 // ``/api/dev``, ``/api/dev/``, ``/api/dev/v1``, and ``/api/dev?param=true`` 593 // but would not match ``/api/developer`` 594 // 595 // Expect the value to not contain ``?`` or ``#`` and not to end in ``/`` 596 string path_separated_prefix = 14 [(validate.rules).string = {pattern: "^[^?#]+[^?#/]$"}]; 597 598 // [#extension-category: envoy.path.match] 599 core.v3.TypedExtensionConfig path_match_policy = 15; 600 } 601 602 // Indicates that prefix/path matching should be case sensitive. The default 603 // is true. Ignored for safe_regex matching. 604 google.protobuf.BoolValue case_sensitive = 4; 605 606 // Indicates that the route should additionally match on a runtime key. Every time the route 607 // is considered for a match, it must also fall under the percentage of matches indicated by 608 // this field. For some fraction N/D, a random number in the range [0,D) is selected. If the 609 // number is <= the value of the numerator N, or if the key is not present, the default 610 // value, the router continues to evaluate the remaining match criteria. A runtime_fraction 611 // route configuration can be used to roll out route changes in a gradual manner without full 612 // code/config deploys. Refer to the :ref:`traffic shifting 613 // <config_http_conn_man_route_table_traffic_splitting_shift>` docs for additional documentation. 614 // 615 // .. note:: 616 // 617 // Parsing this field is implemented such that the runtime key's data may be represented 618 // as a FractionalPercent proto represented as JSON/YAML and may also be represented as an 619 // integer with the assumption that the value is an integral percentage out of 100. For 620 // instance, a runtime key lookup returning the value "42" would parse as a FractionalPercent 621 // whose numerator is 42 and denominator is HUNDRED. This preserves legacy semantics. 622 core.v3.RuntimeFractionalPercent runtime_fraction = 9; 623 624 // Specifies a set of headers that the route should match on. The router will 625 // check the request’s headers against all the specified headers in the route 626 // config. A match will happen if all the headers in the route are present in 627 // the request with the same values (or based on presence if the value field 628 // is not in the config). 629 repeated HeaderMatcher headers = 6; 630 631 // Specifies a set of URL query parameters on which the route should 632 // match. The router will check the query string from the ``path`` header 633 // against all the specified query parameters. If the number of specified 634 // query parameters is nonzero, they all must match the ``path`` header's 635 // query string for a match to occur. 636 // 637 // .. note:: 638 // 639 // If query parameters are used to pass request message fields when 640 // `grpc_json_transcoder <https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/grpc_json_transcoder_filter>`_ 641 // is used, the transcoded message fields maybe different. The query parameters are 642 // url encoded, but the message fields are not. For example, if a query 643 // parameter is "foo%20bar", the message field will be "foo bar". 644 repeated QueryParameterMatcher query_parameters = 7; 645 646 // If specified, only gRPC requests will be matched. The router will check 647 // that the content-type header has a application/grpc or one of the various 648 // application/grpc+ values. 649 GrpcRouteMatchOptions grpc = 8; 650 651 // If specified, the client tls context will be matched against the defined 652 // match options. 653 // 654 // [#next-major-version: unify with RBAC] 655 TlsContextMatchOptions tls_context = 11; 656 657 // Specifies a set of dynamic metadata matchers on which the route should match. 658 // The router will check the dynamic metadata against all the specified dynamic metadata matchers. 659 // If the number of specified dynamic metadata matchers is nonzero, they all must match the 660 // dynamic metadata for a match to occur. 661 repeated type.matcher.v3.MetadataMatcher dynamic_metadata = 13; 662} 663 664// Cors policy configuration. 665// 666// .. attention:: 667// 668// This message has been deprecated. Please use 669// :ref:`CorsPolicy in filter extension <envoy_v3_api_msg_extensions.filters.http.cors.v3.CorsPolicy>` 670// as as alternative. 671// 672// [#next-free-field: 13] 673message CorsPolicy { 674 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.CorsPolicy"; 675 676 reserved 1, 8, 7; 677 678 reserved "allow_origin", "allow_origin_regex", "enabled"; 679 680 // Specifies string patterns that match allowed origins. An origin is allowed if any of the 681 // string matchers match. 682 repeated type.matcher.v3.StringMatcher allow_origin_string_match = 11; 683 684 // Specifies the content for the ``access-control-allow-methods`` header. 685 string allow_methods = 2; 686 687 // Specifies the content for the ``access-control-allow-headers`` header. 688 string allow_headers = 3; 689 690 // Specifies the content for the ``access-control-expose-headers`` header. 691 string expose_headers = 4; 692 693 // Specifies the content for the ``access-control-max-age`` header. 694 string max_age = 5; 695 696 // Specifies whether the resource allows credentials. 697 google.protobuf.BoolValue allow_credentials = 6; 698 699 oneof enabled_specifier { 700 // Specifies the % of requests for which the CORS filter is enabled. 701 // 702 // If neither ``enabled``, ``filter_enabled``, nor ``shadow_enabled`` are specified, the CORS 703 // filter will be enabled for 100% of the requests. 704 // 705 // If :ref:`runtime_key <envoy_v3_api_field_config.core.v3.RuntimeFractionalPercent.runtime_key>` is 706 // specified, Envoy will lookup the runtime key to get the percentage of requests to filter. 707 core.v3.RuntimeFractionalPercent filter_enabled = 9; 708 } 709 710 // Specifies the % of requests for which the CORS policies will be evaluated and tracked, but not 711 // enforced. 712 // 713 // This field is intended to be used when ``filter_enabled`` and ``enabled`` are off. One of those 714 // fields have to explicitly disable the filter in order for this setting to take effect. 715 // 716 // If :ref:`runtime_key <envoy_v3_api_field_config.core.v3.RuntimeFractionalPercent.runtime_key>` is specified, 717 // Envoy will lookup the runtime key to get the percentage of requests for which it will evaluate 718 // and track the request's ``Origin`` to determine if it's valid but will not enforce any policies. 719 core.v3.RuntimeFractionalPercent shadow_enabled = 10; 720 721 // Specify whether allow requests whose target server's IP address is more private than that from 722 // which the request initiator was fetched. 723 // 724 // More details refer to https://developer.chrome.com/blog/private-network-access-preflight. 725 google.protobuf.BoolValue allow_private_network_access = 12; 726} 727 728// [#next-free-field: 42] 729message RouteAction { 730 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.RouteAction"; 731 732 enum ClusterNotFoundResponseCode { 733 // HTTP status code - 503 Service Unavailable. 734 SERVICE_UNAVAILABLE = 0; 735 736 // HTTP status code - 404 Not Found. 737 NOT_FOUND = 1; 738 739 // HTTP status code - 500 Internal Server Error. 740 INTERNAL_SERVER_ERROR = 2; 741 } 742 743 // Configures :ref:`internal redirect <arch_overview_internal_redirects>` behavior. 744 // [#next-major-version: remove this definition - it's defined in the InternalRedirectPolicy message.] 745 enum InternalRedirectAction { 746 option deprecated = true; 747 748 PASS_THROUGH_INTERNAL_REDIRECT = 0; 749 HANDLE_INTERNAL_REDIRECT = 1; 750 } 751 752 // The router is capable of shadowing traffic from one cluster to another. The current 753 // implementation is "fire and forget," meaning Envoy will not wait for the shadow cluster to 754 // respond before returning the response from the primary cluster. All normal statistics are 755 // collected for the shadow cluster making this feature useful for testing. 756 // 757 // During shadowing, the host/authority header is altered such that ``-shadow`` is appended. This is 758 // useful for logging. For example, ``cluster1`` becomes ``cluster1-shadow``. 759 // 760 // .. note:: 761 // 762 // Shadowing will not be triggered if the primary cluster does not exist. 763 // 764 // .. note:: 765 // 766 // Shadowing doesn't support Http CONNECT and upgrades. 767 // [#next-free-field: 6] 768 message RequestMirrorPolicy { 769 option (udpa.annotations.versioning).previous_message_type = 770 "envoy.api.v2.route.RouteAction.RequestMirrorPolicy"; 771 772 reserved 2; 773 774 reserved "runtime_key"; 775 776 // Only one of ``cluster`` and ``cluster_header`` can be specified. 777 // [#next-major-version: Need to add back the validation rule: (validate.rules).string = {min_len: 1}] 778 // Specifies the cluster that requests will be mirrored to. The cluster must 779 // exist in the cluster manager configuration. 780 string cluster = 1 [(udpa.annotations.field_migrate).oneof_promotion = "cluster_specifier"]; 781 782 // Only one of ``cluster`` and ``cluster_header`` can be specified. 783 // Envoy will determine the cluster to route to by reading the value of the 784 // HTTP header named by cluster_header from the request headers. Only the first value in header is used, 785 // and no shadow request will happen if the value is not found in headers. Envoy will not wait for 786 // the shadow cluster to respond before returning the response from the primary cluster. 787 // 788 // .. attention:: 789 // 790 // Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 791 // ``Host`` header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. 792 // 793 // .. note:: 794 // 795 // If the header appears multiple times only the first value is used. 796 string cluster_header = 5 [ 797 (validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}, 798 (udpa.annotations.field_migrate).oneof_promotion = "cluster_specifier" 799 ]; 800 801 // If not specified, all requests to the target cluster will be mirrored. 802 // 803 // If specified, this field takes precedence over the ``runtime_key`` field and requests must also 804 // fall under the percentage of matches indicated by this field. 805 // 806 // For some fraction N/D, a random number in the range [0,D) is selected. If the 807 // number is <= the value of the numerator N, or if the key is not present, the default 808 // value, the request will be mirrored. 809 core.v3.RuntimeFractionalPercent runtime_fraction = 3; 810 811 // Determines if the trace span should be sampled. Defaults to true. 812 google.protobuf.BoolValue trace_sampled = 4; 813 } 814 815 // Specifies the route's hashing policy if the upstream cluster uses a hashing :ref:`load balancer 816 // <arch_overview_load_balancing_types>`. 817 // [#next-free-field: 7] 818 message HashPolicy { 819 option (udpa.annotations.versioning).previous_message_type = 820 "envoy.api.v2.route.RouteAction.HashPolicy"; 821 822 message Header { 823 option (udpa.annotations.versioning).previous_message_type = 824 "envoy.api.v2.route.RouteAction.HashPolicy.Header"; 825 826 // The name of the request header that will be used to obtain the hash 827 // key. If the request header is not present, no hash will be produced. 828 string header_name = 1 829 [(validate.rules).string = {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}]; 830 831 // If specified, the request header value will be rewritten and used 832 // to produce the hash key. 833 type.matcher.v3.RegexMatchAndSubstitute regex_rewrite = 2; 834 } 835 836 // Envoy supports two types of cookie affinity: 837 // 838 // 1. Passive. Envoy takes a cookie that's present in the cookies header and 839 // hashes on its value. 840 // 841 // 2. Generated. Envoy generates and sets a cookie with an expiration (TTL) 842 // on the first request from the client in its response to the client, 843 // based on the endpoint the request gets sent to. The client then 844 // presents this on the next and all subsequent requests. The hash of 845 // this is sufficient to ensure these requests get sent to the same 846 // endpoint. The cookie is generated by hashing the source and 847 // destination ports and addresses so that multiple independent HTTP2 848 // streams on the same connection will independently receive the same 849 // cookie, even if they arrive at the Envoy simultaneously. 850 message Cookie { 851 option (udpa.annotations.versioning).previous_message_type = 852 "envoy.api.v2.route.RouteAction.HashPolicy.Cookie"; 853 854 // The name of the cookie that will be used to obtain the hash key. If the 855 // cookie is not present and ttl below is not set, no hash will be 856 // produced. 857 string name = 1 [(validate.rules).string = {min_len: 1}]; 858 859 // If specified, a cookie with the TTL will be generated if the cookie is 860 // not present. If the TTL is present and zero, the generated cookie will 861 // be a session cookie. 862 google.protobuf.Duration ttl = 2; 863 864 // The name of the path for the cookie. If no path is specified here, no path 865 // will be set for the cookie. 866 string path = 3; 867 } 868 869 message ConnectionProperties { 870 option (udpa.annotations.versioning).previous_message_type = 871 "envoy.api.v2.route.RouteAction.HashPolicy.ConnectionProperties"; 872 873 // Hash on source IP address. 874 bool source_ip = 1; 875 } 876 877 message QueryParameter { 878 option (udpa.annotations.versioning).previous_message_type = 879 "envoy.api.v2.route.RouteAction.HashPolicy.QueryParameter"; 880 881 // The name of the URL query parameter that will be used to obtain the hash 882 // key. If the parameter is not present, no hash will be produced. Query 883 // parameter names are case-sensitive. 884 string name = 1 [(validate.rules).string = {min_len: 1}]; 885 } 886 887 message FilterState { 888 option (udpa.annotations.versioning).previous_message_type = 889 "envoy.api.v2.route.RouteAction.HashPolicy.FilterState"; 890 891 // The name of the Object in the per-request filterState, which is an 892 // Envoy::Hashable object. If there is no data associated with the key, 893 // or the stored object is not Envoy::Hashable, no hash will be produced. 894 string key = 1 [(validate.rules).string = {min_len: 1}]; 895 } 896 897 oneof policy_specifier { 898 option (validate.required) = true; 899 900 // Header hash policy. 901 Header header = 1; 902 903 // Cookie hash policy. 904 Cookie cookie = 2; 905 906 // Connection properties hash policy. 907 ConnectionProperties connection_properties = 3; 908 909 // Query parameter hash policy. 910 QueryParameter query_parameter = 5; 911 912 // Filter state hash policy. 913 FilterState filter_state = 6; 914 } 915 916 // The flag that short-circuits the hash computing. This field provides a 917 // 'fallback' style of configuration: "if a terminal policy doesn't work, 918 // fallback to rest of the policy list", it saves time when the terminal 919 // policy works. 920 // 921 // If true, and there is already a hash computed, ignore rest of the 922 // list of hash polices. 923 // For example, if the following hash methods are configured: 924 // 925 // ========= ======== 926 // specifier terminal 927 // ========= ======== 928 // Header A true 929 // Header B false 930 // Header C false 931 // ========= ======== 932 // 933 // The generateHash process ends if policy "header A" generates a hash, as 934 // it's a terminal policy. 935 bool terminal = 4; 936 } 937 938 // Allows enabling and disabling upgrades on a per-route basis. 939 // This overrides any enabled/disabled upgrade filter chain specified in the 940 // HttpConnectionManager 941 // :ref:`upgrade_configs 942 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.upgrade_configs>` 943 // but does not affect any custom filter chain specified there. 944 message UpgradeConfig { 945 option (udpa.annotations.versioning).previous_message_type = 946 "envoy.api.v2.route.RouteAction.UpgradeConfig"; 947 948 // Configuration for sending data upstream as a raw data payload. This is used for 949 // CONNECT or POST requests, when forwarding request payload as raw TCP. 950 message ConnectConfig { 951 // If present, the proxy protocol header will be prepended to the CONNECT payload sent upstream. 952 core.v3.ProxyProtocolConfig proxy_protocol_config = 1; 953 954 // If set, the route will also allow forwarding POST payload as raw TCP. 955 bool allow_post = 2; 956 } 957 958 // The case-insensitive name of this upgrade, e.g. "websocket". 959 // For each upgrade type present in upgrade_configs, requests with 960 // Upgrade: [upgrade_type] will be proxied upstream. 961 string upgrade_type = 1 962 [(validate.rules).string = {min_len: 1 well_known_regex: HTTP_HEADER_VALUE strict: false}]; 963 964 // Determines if upgrades are available on this route. Defaults to true. 965 google.protobuf.BoolValue enabled = 2; 966 967 // Configuration for sending data upstream as a raw data payload. This is used for 968 // CONNECT requests, when forwarding CONNECT payload as raw TCP. 969 // Note that CONNECT support is currently considered alpha in Envoy. 970 // [#comment: TODO(htuch): Replace the above comment with an alpha tag.] 971 ConnectConfig connect_config = 3; 972 } 973 974 message MaxStreamDuration { 975 // Specifies the maximum duration allowed for streams on the route. If not specified, the value 976 // from the :ref:`max_stream_duration 977 // <envoy_v3_api_field_config.core.v3.HttpProtocolOptions.max_stream_duration>` field in 978 // :ref:`HttpConnectionManager.common_http_protocol_options 979 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.common_http_protocol_options>` 980 // is used. If this field is set explicitly to zero, any 981 // HttpConnectionManager max_stream_duration timeout will be disabled for 982 // this route. 983 google.protobuf.Duration max_stream_duration = 1; 984 985 // If present, and the request contains a `grpc-timeout header 986 // <https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md>`_, use that value as the 987 // ``max_stream_duration``, but limit the applied timeout to the maximum value specified here. 988 // If set to 0, the ``grpc-timeout`` header is used without modification. 989 google.protobuf.Duration grpc_timeout_header_max = 2; 990 991 // If present, Envoy will adjust the timeout provided by the ``grpc-timeout`` header by 992 // subtracting the provided duration from the header. This is useful for allowing Envoy to set 993 // its global timeout to be less than that of the deadline imposed by the calling client, which 994 // makes it more likely that Envoy will handle the timeout instead of having the call canceled 995 // by the client. If, after applying the offset, the resulting timeout is zero or negative, 996 // the stream will timeout immediately. 997 google.protobuf.Duration grpc_timeout_header_offset = 3; 998 } 999 1000 reserved 12, 18, 19, 16, 22, 21, 10; 1001 1002 reserved "request_mirror_policy"; 1003 1004 oneof cluster_specifier { 1005 option (validate.required) = true; 1006 1007 // Indicates the upstream cluster to which the request should be routed 1008 // to. 1009 string cluster = 1 [(validate.rules).string = {min_len: 1}]; 1010 1011 // Envoy will determine the cluster to route to by reading the value of the 1012 // HTTP header named by cluster_header from the request headers. If the 1013 // header is not found or the referenced cluster does not exist, Envoy will 1014 // return a 404 response. 1015 // 1016 // .. attention:: 1017 // 1018 // Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 1019 // ``Host`` header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. 1020 // 1021 // .. note:: 1022 // 1023 // If the header appears multiple times only the first value is used. 1024 string cluster_header = 2 1025 [(validate.rules).string = {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}]; 1026 1027 // Multiple upstream clusters can be specified for a given route. The 1028 // request is routed to one of the upstream clusters based on weights 1029 // assigned to each cluster. See 1030 // :ref:`traffic splitting <config_http_conn_man_route_table_traffic_splitting_split>` 1031 // for additional documentation. 1032 WeightedCluster weighted_clusters = 3; 1033 1034 // Name of the cluster specifier plugin to use to determine the cluster for requests on this route. 1035 // The cluster specifier plugin name must be defined in the associated 1036 // :ref:`cluster specifier plugins <envoy_v3_api_field_config.route.v3.RouteConfiguration.cluster_specifier_plugins>` 1037 // in the :ref:`name <envoy_v3_api_field_config.core.v3.TypedExtensionConfig.name>` field. 1038 string cluster_specifier_plugin = 37; 1039 1040 // Custom cluster specifier plugin configuration to use to determine the cluster for requests 1041 // on this route. 1042 ClusterSpecifierPlugin inline_cluster_specifier_plugin = 39; 1043 } 1044 1045 // The HTTP status code to use when configured cluster is not found. 1046 // The default response code is 503 Service Unavailable. 1047 ClusterNotFoundResponseCode cluster_not_found_response_code = 20 1048 [(validate.rules).enum = {defined_only: true}]; 1049 1050 // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints 1051 // in the upstream cluster with metadata matching what's set in this field will be considered 1052 // for load balancing. If using :ref:`weighted_clusters 1053 // <envoy_v3_api_field_config.route.v3.RouteAction.weighted_clusters>`, metadata will be merged, with values 1054 // provided there taking precedence. The filter name should be specified as ``envoy.lb``. 1055 core.v3.Metadata metadata_match = 4; 1056 1057 // Indicates that during forwarding, the matched prefix (or path) should be 1058 // swapped with this value. This option allows application URLs to be rooted 1059 // at a different path from those exposed at the reverse proxy layer. The router filter will 1060 // place the original path before rewrite into the :ref:`x-envoy-original-path 1061 // <config_http_filters_router_x-envoy-original-path>` header. 1062 // 1063 // Only one of :ref:`regex_rewrite <envoy_v3_api_field_config.route.v3.RouteAction.regex_rewrite>` 1064 // :ref:`path_rewrite_policy <envoy_v3_api_field_config.route.v3.RouteAction.path_rewrite_policy>`, 1065 // or :ref:`prefix_rewrite <envoy_v3_api_field_config.route.v3.RouteAction.prefix_rewrite>` may be specified. 1066 // 1067 // .. attention:: 1068 // 1069 // Pay careful attention to the use of trailing slashes in the 1070 // :ref:`route's match <envoy_v3_api_field_config.route.v3.Route.match>` prefix value. 1071 // Stripping a prefix from a path requires multiple Routes to handle all cases. For example, 1072 // rewriting ``/prefix`` to ``/`` and ``/prefix/etc`` to ``/etc`` cannot be done in a single 1073 // :ref:`Route <envoy_v3_api_msg_config.route.v3.Route>`, as shown by the below config entries: 1074 // 1075 // .. code-block:: yaml 1076 // 1077 // - match: 1078 // prefix: "/prefix/" 1079 // route: 1080 // prefix_rewrite: "/" 1081 // - match: 1082 // prefix: "/prefix" 1083 // route: 1084 // prefix_rewrite: "/" 1085 // 1086 // Having above entries in the config, requests to ``/prefix`` will be stripped to ``/``, while 1087 // requests to ``/prefix/etc`` will be stripped to ``/etc``. 1088 string prefix_rewrite = 5 1089 [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; 1090 1091 // Indicates that during forwarding, portions of the path that match the 1092 // pattern should be rewritten, even allowing the substitution of capture 1093 // groups from the pattern into the new path as specified by the rewrite 1094 // substitution string. This is useful to allow application paths to be 1095 // rewritten in a way that is aware of segments with variable content like 1096 // identifiers. The router filter will place the original path as it was 1097 // before the rewrite into the :ref:`x-envoy-original-path 1098 // <config_http_filters_router_x-envoy-original-path>` header. 1099 // 1100 // Only one of :ref:`regex_rewrite <envoy_v3_api_field_config.route.v3.RouteAction.regex_rewrite>`, 1101 // :ref:`prefix_rewrite <envoy_v3_api_field_config.route.v3.RouteAction.prefix_rewrite>`, or 1102 // :ref:`path_rewrite_policy <envoy_v3_api_field_config.route.v3.RouteAction.path_rewrite_policy>`] 1103 // may be specified. 1104 // 1105 // Examples using Google's `RE2 <https://github.com/google/re2>`_ engine: 1106 // 1107 // * The path pattern ``^/service/([^/]+)(/.*)$`` paired with a substitution 1108 // string of ``\2/instance/\1`` would transform ``/service/foo/v1/api`` 1109 // into ``/v1/api/instance/foo``. 1110 // 1111 // * The pattern ``one`` paired with a substitution string of ``two`` would 1112 // transform ``/xxx/one/yyy/one/zzz`` into ``/xxx/two/yyy/two/zzz``. 1113 // 1114 // * The pattern ``^(.*?)one(.*)$`` paired with a substitution string of 1115 // ``\1two\2`` would replace only the first occurrence of ``one``, 1116 // transforming path ``/xxx/one/yyy/one/zzz`` into ``/xxx/two/yyy/one/zzz``. 1117 // 1118 // * The pattern ``(?i)/xxx/`` paired with a substitution string of ``/yyy/`` 1119 // would do a case-insensitive match and transform path ``/aaa/XxX/bbb`` to 1120 // ``/aaa/yyy/bbb``. 1121 type.matcher.v3.RegexMatchAndSubstitute regex_rewrite = 32; 1122 1123 // [#extension-category: envoy.path.rewrite] 1124 core.v3.TypedExtensionConfig path_rewrite_policy = 41; 1125 1126 oneof host_rewrite_specifier { 1127 // Indicates that during forwarding, the host header will be swapped with 1128 // this value. Using this option will append the 1129 // :ref:`config_http_conn_man_headers_x-forwarded-host` header if 1130 // :ref:`append_x_forwarded_host <envoy_v3_api_field_config.route.v3.RouteAction.append_x_forwarded_host>` 1131 // is set. 1132 string host_rewrite_literal = 6 1133 [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; 1134 1135 // Indicates that during forwarding, the host header will be swapped with 1136 // the hostname of the upstream host chosen by the cluster manager. This 1137 // option is applicable only when the destination cluster for a route is of 1138 // type ``strict_dns`` or ``logical_dns``. Setting this to true with other cluster types 1139 // has no effect. Using this option will append the 1140 // :ref:`config_http_conn_man_headers_x-forwarded-host` header if 1141 // :ref:`append_x_forwarded_host <envoy_v3_api_field_config.route.v3.RouteAction.append_x_forwarded_host>` 1142 // is set. 1143 google.protobuf.BoolValue auto_host_rewrite = 7; 1144 1145 // Indicates that during forwarding, the host header will be swapped with the content of given 1146 // downstream or :ref:`custom <config_http_conn_man_headers_custom_request_headers>` header. 1147 // If header value is empty, host header is left intact. Using this option will append the 1148 // :ref:`config_http_conn_man_headers_x-forwarded-host` header if 1149 // :ref:`append_x_forwarded_host <envoy_v3_api_field_config.route.v3.RouteAction.append_x_forwarded_host>` 1150 // is set. 1151 // 1152 // .. attention:: 1153 // 1154 // Pay attention to the potential security implications of using this option. Provided header 1155 // must come from trusted source. 1156 // 1157 // .. note:: 1158 // 1159 // If the header appears multiple times only the first value is used. 1160 string host_rewrite_header = 29 1161 [(validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false}]; 1162 1163 // Indicates that during forwarding, the host header will be swapped with 1164 // the result of the regex substitution executed on path value with query and fragment removed. 1165 // This is useful for transitioning variable content between path segment and subdomain. 1166 // Using this option will append the 1167 // :ref:`config_http_conn_man_headers_x-forwarded-host` header if 1168 // :ref:`append_x_forwarded_host <envoy_v3_api_field_config.route.v3.RouteAction.append_x_forwarded_host>` 1169 // is set. 1170 // 1171 // For example with the following config: 1172 // 1173 // .. code-block:: yaml 1174 // 1175 // host_rewrite_path_regex: 1176 // pattern: 1177 // google_re2: {} 1178 // regex: "^/(.+)/.+$" 1179 // substitution: \1 1180 // 1181 // Would rewrite the host header to ``envoyproxy.io`` given the path ``/envoyproxy.io/some/path``. 1182 type.matcher.v3.RegexMatchAndSubstitute host_rewrite_path_regex = 35; 1183 } 1184 1185 // If set, then a host rewrite action (one of 1186 // :ref:`host_rewrite_literal <envoy_v3_api_field_config.route.v3.RouteAction.host_rewrite_literal>`, 1187 // :ref:`auto_host_rewrite <envoy_v3_api_field_config.route.v3.RouteAction.auto_host_rewrite>`, 1188 // :ref:`host_rewrite_header <envoy_v3_api_field_config.route.v3.RouteAction.host_rewrite_header>`, or 1189 // :ref:`host_rewrite_path_regex <envoy_v3_api_field_config.route.v3.RouteAction.host_rewrite_path_regex>`) 1190 // causes the original value of the host header, if any, to be appended to the 1191 // :ref:`config_http_conn_man_headers_x-forwarded-host` HTTP header. 1192 bool append_x_forwarded_host = 38; 1193 1194 // Specifies the upstream timeout for the route. If not specified, the default is 15s. This 1195 // spans between the point at which the entire downstream request (i.e. end-of-stream) has been 1196 // processed and when the upstream response has been completely processed. A value of 0 will 1197 // disable the route's timeout. 1198 // 1199 // .. note:: 1200 // 1201 // This timeout includes all retries. See also 1202 // :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, 1203 // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms`, and the 1204 // :ref:`retry overview <arch_overview_http_routing_retry>`. 1205 google.protobuf.Duration timeout = 8; 1206 1207 // Specifies the idle timeout for the route. If not specified, there is no per-route idle timeout, 1208 // although the connection manager wide :ref:`stream_idle_timeout 1209 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.stream_idle_timeout>` 1210 // will still apply. A value of 0 will completely disable the route's idle timeout, even if a 1211 // connection manager stream idle timeout is configured. 1212 // 1213 // The idle timeout is distinct to :ref:`timeout 1214 // <envoy_v3_api_field_config.route.v3.RouteAction.timeout>`, which provides an upper bound 1215 // on the upstream response time; :ref:`idle_timeout 1216 // <envoy_v3_api_field_config.route.v3.RouteAction.idle_timeout>` instead bounds the amount 1217 // of time the request's stream may be idle. 1218 // 1219 // After header decoding, the idle timeout will apply on downstream and 1220 // upstream request events. Each time an encode/decode event for headers or 1221 // data is processed for the stream, the timer will be reset. If the timeout 1222 // fires, the stream is terminated with a 408 Request Timeout error code if no 1223 // upstream response header has been received, otherwise a stream reset 1224 // occurs. 1225 // 1226 // If the :ref:`overload action <config_overload_manager_overload_actions>` "envoy.overload_actions.reduce_timeouts" 1227 // is configured, this timeout is scaled according to the value for 1228 // :ref:`HTTP_DOWNSTREAM_STREAM_IDLE <envoy_v3_api_enum_value_config.overload.v3.ScaleTimersOverloadActionConfig.TimerType.HTTP_DOWNSTREAM_STREAM_IDLE>`. 1229 google.protobuf.Duration idle_timeout = 24; 1230 1231 // Specifies how to send request over TLS early data. 1232 // If absent, allows `safe HTTP requests <https://www.rfc-editor.org/rfc/rfc7231#section-4.2.1>`_ to be sent on early data. 1233 // [#extension-category: envoy.route.early_data_policy] 1234 core.v3.TypedExtensionConfig early_data_policy = 40; 1235 1236 // Indicates that the route has a retry policy. Note that if this is set, 1237 // it'll take precedence over the virtual host level retry policy entirely 1238 // (e.g.: policies are not merged, most internal one becomes the enforced policy). 1239 RetryPolicy retry_policy = 9; 1240 1241 // [#not-implemented-hide:] 1242 // Specifies the configuration for retry policy extension. Note that if this is set, it'll take 1243 // precedence over the virtual host level retry policy entirely (e.g.: policies are not merged, 1244 // most internal one becomes the enforced policy). :ref:`Retry policy <envoy_v3_api_field_config.route.v3.VirtualHost.retry_policy>` 1245 // should not be set if this field is used. 1246 google.protobuf.Any retry_policy_typed_config = 33; 1247 1248 // Specify a set of route request mirroring policies. 1249 // It takes precedence over the virtual host and route config mirror policy entirely. 1250 // That is, policies are not merged, the most specific non-empty one becomes the mirror policies. 1251 repeated RequestMirrorPolicy request_mirror_policies = 30; 1252 1253 // Optionally specifies the :ref:`routing priority <arch_overview_http_routing_priority>`. 1254 core.v3.RoutingPriority priority = 11 [(validate.rules).enum = {defined_only: true}]; 1255 1256 // Specifies a set of rate limit configurations that could be applied to the 1257 // route. 1258 repeated RateLimit rate_limits = 13; 1259 1260 // Specifies if the rate limit filter should include the virtual host rate 1261 // limits. By default, if the route configured rate limits, the virtual host 1262 // :ref:`rate_limits <envoy_v3_api_field_config.route.v3.VirtualHost.rate_limits>` are not applied to the 1263 // request. 1264 // 1265 // This field is deprecated. Please use :ref:`vh_rate_limits <envoy_v3_api_field_extensions.filters.http.ratelimit.v3.RateLimitPerRoute.vh_rate_limits>` 1266 google.protobuf.BoolValue include_vh_rate_limits = 14 1267 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 1268 1269 // Specifies a list of hash policies to use for ring hash load balancing. Each 1270 // hash policy is evaluated individually and the combined result is used to 1271 // route the request. The method of combination is deterministic such that 1272 // identical lists of hash policies will produce the same hash. Since a hash 1273 // policy examines specific parts of a request, it can fail to produce a hash 1274 // (i.e. if the hashed header is not present). If (and only if) all configured 1275 // hash policies fail to generate a hash, no hash will be produced for 1276 // the route. In this case, the behavior is the same as if no hash policies 1277 // were specified (i.e. the ring hash load balancer will choose a random 1278 // backend). If a hash policy has the "terminal" attribute set to true, and 1279 // there is already a hash generated, the hash is returned immediately, 1280 // ignoring the rest of the hash policy list. 1281 repeated HashPolicy hash_policy = 15; 1282 1283 // Indicates that the route has a CORS policy. This field is ignored if related cors policy is 1284 // found in the :ref:`Route.typed_per_filter_config<envoy_v3_api_field_config.route.v3.Route.typed_per_filter_config>` or 1285 // :ref:`WeightedCluster.ClusterWeight.typed_per_filter_config<envoy_v3_api_field_config.route.v3.WeightedCluster.ClusterWeight.typed_per_filter_config>`. 1286 // 1287 // .. attention:: 1288 // 1289 // This option has been deprecated. Please use 1290 // :ref:`Route.typed_per_filter_config<envoy_v3_api_field_config.route.v3.Route.typed_per_filter_config>` or 1291 // :ref:`WeightedCluster.ClusterWeight.typed_per_filter_config<envoy_v3_api_field_config.route.v3.WeightedCluster.ClusterWeight.typed_per_filter_config>` 1292 // to configure the CORS HTTP filter. 1293 CorsPolicy cors = 17 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 1294 1295 // Deprecated by :ref:`grpc_timeout_header_max <envoy_v3_api_field_config.route.v3.RouteAction.MaxStreamDuration.grpc_timeout_header_max>` 1296 // If present, and the request is a gRPC request, use the 1297 // `grpc-timeout header <https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md>`_, 1298 // or its default value (infinity) instead of 1299 // :ref:`timeout <envoy_v3_api_field_config.route.v3.RouteAction.timeout>`, but limit the applied timeout 1300 // to the maximum value specified here. If configured as 0, the maximum allowed timeout for 1301 // gRPC requests is infinity. If not configured at all, the ``grpc-timeout`` header is not used 1302 // and gRPC requests time out like any other requests using 1303 // :ref:`timeout <envoy_v3_api_field_config.route.v3.RouteAction.timeout>` or its default. 1304 // This can be used to prevent unexpected upstream request timeouts due to potentially long 1305 // time gaps between gRPC request and response in gRPC streaming mode. 1306 // 1307 // .. note:: 1308 // 1309 // If a timeout is specified using :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, it takes 1310 // precedence over `grpc-timeout header <https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md>`_, when 1311 // both are present. See also 1312 // :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, 1313 // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms`, and the 1314 // :ref:`retry overview <arch_overview_http_routing_retry>`. 1315 google.protobuf.Duration max_grpc_timeout = 23 1316 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 1317 1318 // Deprecated by :ref:`grpc_timeout_header_offset <envoy_v3_api_field_config.route.v3.RouteAction.MaxStreamDuration.grpc_timeout_header_offset>`. 1319 // If present, Envoy will adjust the timeout provided by the ``grpc-timeout`` header by subtracting 1320 // the provided duration from the header. This is useful in allowing Envoy to set its global 1321 // timeout to be less than that of the deadline imposed by the calling client, which makes it more 1322 // likely that Envoy will handle the timeout instead of having the call canceled by the client. 1323 // The offset will only be applied if the provided grpc_timeout is greater than the offset. This 1324 // ensures that the offset will only ever decrease the timeout and never set it to 0 (meaning 1325 // infinity). 1326 google.protobuf.Duration grpc_timeout_offset = 28 1327 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 1328 1329 repeated UpgradeConfig upgrade_configs = 25; 1330 1331 // If present, Envoy will try to follow an upstream redirect response instead of proxying the 1332 // response back to the downstream. An upstream redirect response is defined 1333 // by :ref:`redirect_response_codes 1334 // <envoy_v3_api_field_config.route.v3.InternalRedirectPolicy.redirect_response_codes>`. 1335 InternalRedirectPolicy internal_redirect_policy = 34; 1336 1337 InternalRedirectAction internal_redirect_action = 26 1338 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 1339 1340 // An internal redirect is handled, iff the number of previous internal redirects that a 1341 // downstream request has encountered is lower than this value, and 1342 // :ref:`internal_redirect_action <envoy_v3_api_field_config.route.v3.RouteAction.internal_redirect_action>` 1343 // is set to :ref:`HANDLE_INTERNAL_REDIRECT 1344 // <envoy_v3_api_enum_value_config.route.v3.RouteAction.InternalRedirectAction.HANDLE_INTERNAL_REDIRECT>` 1345 // In the case where a downstream request is bounced among multiple routes by internal redirect, 1346 // the first route that hits this threshold, or has 1347 // :ref:`internal_redirect_action <envoy_v3_api_field_config.route.v3.RouteAction.internal_redirect_action>` 1348 // set to 1349 // :ref:`PASS_THROUGH_INTERNAL_REDIRECT 1350 // <envoy_v3_api_enum_value_config.route.v3.RouteAction.InternalRedirectAction.PASS_THROUGH_INTERNAL_REDIRECT>` 1351 // will pass the redirect back to downstream. 1352 // 1353 // If not specified, at most one redirect will be followed. 1354 google.protobuf.UInt32Value max_internal_redirects = 31 1355 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 1356 1357 // Indicates that the route has a hedge policy. Note that if this is set, 1358 // it'll take precedence over the virtual host level hedge policy entirely 1359 // (e.g.: policies are not merged, most internal one becomes the enforced policy). 1360 HedgePolicy hedge_policy = 27; 1361 1362 // Specifies the maximum stream duration for this route. 1363 MaxStreamDuration max_stream_duration = 36; 1364} 1365 1366// HTTP retry :ref:`architecture overview <arch_overview_http_routing_retry>`. 1367// [#next-free-field: 14] 1368message RetryPolicy { 1369 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.RetryPolicy"; 1370 1371 enum ResetHeaderFormat { 1372 SECONDS = 0; 1373 UNIX_TIMESTAMP = 1; 1374 } 1375 1376 message RetryPriority { 1377 option (udpa.annotations.versioning).previous_message_type = 1378 "envoy.api.v2.route.RetryPolicy.RetryPriority"; 1379 1380 reserved 2; 1381 1382 reserved "config"; 1383 1384 string name = 1 [(validate.rules).string = {min_len: 1}]; 1385 1386 // [#extension-category: envoy.retry_priorities] 1387 oneof config_type { 1388 google.protobuf.Any typed_config = 3; 1389 } 1390 } 1391 1392 message RetryHostPredicate { 1393 option (udpa.annotations.versioning).previous_message_type = 1394 "envoy.api.v2.route.RetryPolicy.RetryHostPredicate"; 1395 1396 reserved 2; 1397 1398 reserved "config"; 1399 1400 string name = 1 [(validate.rules).string = {min_len: 1}]; 1401 1402 // [#extension-category: envoy.retry_host_predicates] 1403 oneof config_type { 1404 google.protobuf.Any typed_config = 3; 1405 } 1406 } 1407 1408 message RetryBackOff { 1409 option (udpa.annotations.versioning).previous_message_type = 1410 "envoy.api.v2.route.RetryPolicy.RetryBackOff"; 1411 1412 // Specifies the base interval between retries. This parameter is required and must be greater 1413 // than zero. Values less than 1 ms are rounded up to 1 ms. 1414 // See :ref:`config_http_filters_router_x-envoy-max-retries` for a discussion of Envoy's 1415 // back-off algorithm. 1416 google.protobuf.Duration base_interval = 1 [(validate.rules).duration = { 1417 required: true 1418 gt {} 1419 }]; 1420 1421 // Specifies the maximum interval between retries. This parameter is optional, but must be 1422 // greater than or equal to the ``base_interval`` if set. The default is 10 times the 1423 // ``base_interval``. See :ref:`config_http_filters_router_x-envoy-max-retries` for a discussion 1424 // of Envoy's back-off algorithm. 1425 google.protobuf.Duration max_interval = 2 [(validate.rules).duration = {gt {}}]; 1426 } 1427 1428 message ResetHeader { 1429 // The name of the reset header. 1430 // 1431 // .. note:: 1432 // 1433 // If the header appears multiple times only the first value is used. 1434 string name = 1 1435 [(validate.rules).string = {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}]; 1436 1437 // The format of the reset header. 1438 ResetHeaderFormat format = 2 [(validate.rules).enum = {defined_only: true}]; 1439 } 1440 1441 // A retry back-off strategy that applies when the upstream server rate limits 1442 // the request. 1443 // 1444 // Given this configuration: 1445 // 1446 // .. code-block:: yaml 1447 // 1448 // rate_limited_retry_back_off: 1449 // reset_headers: 1450 // - name: Retry-After 1451 // format: SECONDS 1452 // - name: X-RateLimit-Reset 1453 // format: UNIX_TIMESTAMP 1454 // max_interval: "300s" 1455 // 1456 // The following algorithm will apply: 1457 // 1458 // 1. If the response contains the header ``Retry-After`` its value must be on 1459 // the form ``120`` (an integer that represents the number of seconds to 1460 // wait before retrying). If so, this value is used as the back-off interval. 1461 // 2. Otherwise, if the response contains the header ``X-RateLimit-Reset`` its 1462 // value must be on the form ``1595320702`` (an integer that represents the 1463 // point in time at which to retry, as a Unix timestamp in seconds). If so, 1464 // the current time is subtracted from this value and the result is used as 1465 // the back-off interval. 1466 // 3. Otherwise, Envoy will use the default 1467 // :ref:`exponential back-off <envoy_v3_api_field_config.route.v3.RetryPolicy.retry_back_off>` 1468 // strategy. 1469 // 1470 // No matter which format is used, if the resulting back-off interval exceeds 1471 // ``max_interval`` it is discarded and the next header in ``reset_headers`` 1472 // is tried. If a request timeout is configured for the route it will further 1473 // limit how long the request will be allowed to run. 1474 // 1475 // To prevent many clients retrying at the same point in time jitter is added 1476 // to the back-off interval, so the resulting interval is decided by taking: 1477 // ``random(interval, interval * 1.5)``. 1478 // 1479 // .. attention:: 1480 // 1481 // Configuring ``rate_limited_retry_back_off`` will not by itself cause a request 1482 // to be retried. You will still need to configure the right retry policy to match 1483 // the responses from the upstream server. 1484 message RateLimitedRetryBackOff { 1485 // Specifies the reset headers (like ``Retry-After`` or ``X-RateLimit-Reset``) 1486 // to match against the response. Headers are tried in order, and matched case 1487 // insensitive. The first header to be parsed successfully is used. If no headers 1488 // match the default exponential back-off is used instead. 1489 repeated ResetHeader reset_headers = 1 [(validate.rules).repeated = {min_items: 1}]; 1490 1491 // Specifies the maximum back off interval that Envoy will allow. If a reset 1492 // header contains an interval longer than this then it will be discarded and 1493 // the next header will be tried. Defaults to 300 seconds. 1494 google.protobuf.Duration max_interval = 2 [(validate.rules).duration = {gt {}}]; 1495 } 1496 1497 // Specifies the conditions under which retry takes place. These are the same 1498 // conditions documented for :ref:`config_http_filters_router_x-envoy-retry-on` and 1499 // :ref:`config_http_filters_router_x-envoy-retry-grpc-on`. 1500 string retry_on = 1; 1501 1502 // Specifies the allowed number of retries. This parameter is optional and 1503 // defaults to 1. These are the same conditions documented for 1504 // :ref:`config_http_filters_router_x-envoy-max-retries`. 1505 google.protobuf.UInt32Value num_retries = 2 1506 [(udpa.annotations.field_migrate).rename = "max_retries"]; 1507 1508 // Specifies a non-zero upstream timeout per retry attempt (including the initial attempt). This 1509 // parameter is optional. The same conditions documented for 1510 // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms` apply. 1511 // 1512 // .. note:: 1513 // 1514 // If left unspecified, Envoy will use the global 1515 // :ref:`route timeout <envoy_v3_api_field_config.route.v3.RouteAction.timeout>` for the request. 1516 // Consequently, when using a :ref:`5xx <config_http_filters_router_x-envoy-retry-on>` based 1517 // retry policy, a request that times out will not be retried as the total timeout budget 1518 // would have been exhausted. 1519 google.protobuf.Duration per_try_timeout = 3; 1520 1521 // Specifies an upstream idle timeout per retry attempt (including the initial attempt). This 1522 // parameter is optional and if absent there is no per try idle timeout. The semantics of the per 1523 // try idle timeout are similar to the 1524 // :ref:`route idle timeout <envoy_v3_api_field_config.route.v3.RouteAction.timeout>` and 1525 // :ref:`stream idle timeout 1526 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.stream_idle_timeout>` 1527 // both enforced by the HTTP connection manager. The difference is that this idle timeout 1528 // is enforced by the router for each individual attempt and thus after all previous filters have 1529 // run, as opposed to *before* all previous filters run for the other idle timeouts. This timeout 1530 // is useful in cases in which total request timeout is bounded by a number of retries and a 1531 // :ref:`per_try_timeout <envoy_v3_api_field_config.route.v3.RetryPolicy.per_try_timeout>`, but 1532 // there is a desire to ensure each try is making incremental progress. Note also that similar 1533 // to :ref:`per_try_timeout <envoy_v3_api_field_config.route.v3.RetryPolicy.per_try_timeout>`, 1534 // this idle timeout does not start until after both the entire request has been received by the 1535 // router *and* a connection pool connection has been obtained. Unlike 1536 // :ref:`per_try_timeout <envoy_v3_api_field_config.route.v3.RetryPolicy.per_try_timeout>`, 1537 // the idle timer continues once the response starts streaming back to the downstream client. 1538 // This ensures that response data continues to make progress without using one of the HTTP 1539 // connection manager idle timeouts. 1540 google.protobuf.Duration per_try_idle_timeout = 13; 1541 1542 // Specifies an implementation of a RetryPriority which is used to determine the 1543 // distribution of load across priorities used for retries. Refer to 1544 // :ref:`retry plugin configuration <arch_overview_http_retry_plugins>` for more details. 1545 RetryPriority retry_priority = 4; 1546 1547 // Specifies a collection of RetryHostPredicates that will be consulted when selecting a host 1548 // for retries. If any of the predicates reject the host, host selection will be reattempted. 1549 // Refer to :ref:`retry plugin configuration <arch_overview_http_retry_plugins>` for more 1550 // details. 1551 repeated RetryHostPredicate retry_host_predicate = 5; 1552 1553 // Retry options predicates that will be applied prior to retrying a request. These predicates 1554 // allow customizing request behavior between retries. 1555 // [#comment: add [#extension-category: envoy.retry_options_predicates] when there are built-in extensions] 1556 repeated core.v3.TypedExtensionConfig retry_options_predicates = 12; 1557 1558 // The maximum number of times host selection will be reattempted before giving up, at which 1559 // point the host that was last selected will be routed to. If unspecified, this will default to 1560 // retrying once. 1561 int64 host_selection_retry_max_attempts = 6; 1562 1563 // HTTP status codes that should trigger a retry in addition to those specified by retry_on. 1564 repeated uint32 retriable_status_codes = 7; 1565 1566 // Specifies parameters that control exponential retry back off. This parameter is optional, in which case the 1567 // default base interval is 25 milliseconds or, if set, the current value of the 1568 // ``upstream.base_retry_backoff_ms`` runtime parameter. The default maximum interval is 10 times 1569 // the base interval. The documentation for :ref:`config_http_filters_router_x-envoy-max-retries` 1570 // describes Envoy's back-off algorithm. 1571 RetryBackOff retry_back_off = 8; 1572 1573 // Specifies parameters that control a retry back-off strategy that is used 1574 // when the request is rate limited by the upstream server. The server may 1575 // return a response header like ``Retry-After`` or ``X-RateLimit-Reset`` to 1576 // provide feedback to the client on how long to wait before retrying. If 1577 // configured, this back-off strategy will be used instead of the 1578 // default exponential back off strategy (configured using ``retry_back_off``) 1579 // whenever a response includes the matching headers. 1580 RateLimitedRetryBackOff rate_limited_retry_back_off = 11; 1581 1582 // HTTP response headers that trigger a retry if present in the response. A retry will be 1583 // triggered if any of the header matches match the upstream response headers. 1584 // The field is only consulted if 'retriable-headers' retry policy is active. 1585 repeated HeaderMatcher retriable_headers = 9; 1586 1587 // HTTP headers which must be present in the request for retries to be attempted. 1588 repeated HeaderMatcher retriable_request_headers = 10; 1589} 1590 1591// HTTP request hedging :ref:`architecture overview <arch_overview_http_routing_hedging>`. 1592message HedgePolicy { 1593 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.HedgePolicy"; 1594 1595 // Specifies the number of initial requests that should be sent upstream. 1596 // Must be at least 1. 1597 // Defaults to 1. 1598 // [#not-implemented-hide:] 1599 google.protobuf.UInt32Value initial_requests = 1 [(validate.rules).uint32 = {gte: 1}]; 1600 1601 // Specifies a probability that an additional upstream request should be sent 1602 // on top of what is specified by initial_requests. 1603 // Defaults to 0. 1604 // [#not-implemented-hide:] 1605 type.v3.FractionalPercent additional_request_chance = 2; 1606 1607 // Indicates that a hedged request should be sent when the per-try timeout is hit. 1608 // This means that a retry will be issued without resetting the original request, leaving multiple upstream requests in flight. 1609 // The first request to complete successfully will be the one returned to the caller. 1610 // 1611 // * At any time, a successful response (i.e. not triggering any of the retry-on conditions) would be returned to the client. 1612 // * Before per-try timeout, an error response (per retry-on conditions) would be retried immediately or returned ot the client 1613 // if there are no more retries left. 1614 // * After per-try timeout, an error response would be discarded, as a retry in the form of a hedged request is already in progress. 1615 // 1616 // Note: For this to have effect, you must have a :ref:`RetryPolicy <envoy_v3_api_msg_config.route.v3.RetryPolicy>` that retries at least 1617 // one error code and specifies a maximum number of retries. 1618 // 1619 // Defaults to false. 1620 bool hedge_on_per_try_timeout = 3; 1621} 1622 1623// [#next-free-field: 10] 1624message RedirectAction { 1625 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.RedirectAction"; 1626 1627 enum RedirectResponseCode { 1628 // Moved Permanently HTTP Status Code - 301. 1629 MOVED_PERMANENTLY = 0; 1630 1631 // Found HTTP Status Code - 302. 1632 FOUND = 1; 1633 1634 // See Other HTTP Status Code - 303. 1635 SEE_OTHER = 2; 1636 1637 // Temporary Redirect HTTP Status Code - 307. 1638 TEMPORARY_REDIRECT = 3; 1639 1640 // Permanent Redirect HTTP Status Code - 308. 1641 PERMANENT_REDIRECT = 4; 1642 } 1643 1644 // When the scheme redirection take place, the following rules apply: 1645 // 1. If the source URI scheme is ``http`` and the port is explicitly 1646 // set to ``:80``, the port will be removed after the redirection 1647 // 2. If the source URI scheme is ``https`` and the port is explicitly 1648 // set to ``:443``, the port will be removed after the redirection 1649 oneof scheme_rewrite_specifier { 1650 // The scheme portion of the URL will be swapped with "https". 1651 bool https_redirect = 4; 1652 1653 // The scheme portion of the URL will be swapped with this value. 1654 string scheme_redirect = 7; 1655 } 1656 1657 // The host portion of the URL will be swapped with this value. 1658 string host_redirect = 1 1659 [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; 1660 1661 // The port value of the URL will be swapped with this value. 1662 uint32 port_redirect = 8; 1663 1664 oneof path_rewrite_specifier { 1665 // The path portion of the URL will be swapped with this value. 1666 // Please note that query string in path_redirect will override the 1667 // request's query string and will not be stripped. 1668 // 1669 // For example, let's say we have the following routes: 1670 // 1671 // - match: { path: "/old-path-1" } 1672 // redirect: { path_redirect: "/new-path-1" } 1673 // - match: { path: "/old-path-2" } 1674 // redirect: { path_redirect: "/new-path-2", strip-query: "true" } 1675 // - match: { path: "/old-path-3" } 1676 // redirect: { path_redirect: "/new-path-3?foo=1", strip_query: "true" } 1677 // 1678 // 1. if request uri is "/old-path-1?bar=1", users will be redirected to "/new-path-1?bar=1" 1679 // 2. if request uri is "/old-path-2?bar=1", users will be redirected to "/new-path-2" 1680 // 3. if request uri is "/old-path-3?bar=1", users will be redirected to "/new-path-3?foo=1" 1681 string path_redirect = 2 1682 [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; 1683 1684 // Indicates that during redirection, the matched prefix (or path) 1685 // should be swapped with this value. This option allows redirect URLs be dynamically created 1686 // based on the request. 1687 // 1688 // .. attention:: 1689 // 1690 // Pay attention to the use of trailing slashes as mentioned in 1691 // :ref:`RouteAction's prefix_rewrite <envoy_v3_api_field_config.route.v3.RouteAction.prefix_rewrite>`. 1692 string prefix_rewrite = 5 1693 [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; 1694 1695 // Indicates that during redirect, portions of the path that match the 1696 // pattern should be rewritten, even allowing the substitution of capture 1697 // groups from the pattern into the new path as specified by the rewrite 1698 // substitution string. This is useful to allow application paths to be 1699 // rewritten in a way that is aware of segments with variable content like 1700 // identifiers. 1701 // 1702 // Examples using Google's `RE2 <https://github.com/google/re2>`_ engine: 1703 // 1704 // * The path pattern ``^/service/([^/]+)(/.*)$`` paired with a substitution 1705 // string of ``\2/instance/\1`` would transform ``/service/foo/v1/api`` 1706 // into ``/v1/api/instance/foo``. 1707 // 1708 // * The pattern ``one`` paired with a substitution string of ``two`` would 1709 // transform ``/xxx/one/yyy/one/zzz`` into ``/xxx/two/yyy/two/zzz``. 1710 // 1711 // * The pattern ``^(.*?)one(.*)$`` paired with a substitution string of 1712 // ``\1two\2`` would replace only the first occurrence of ``one``, 1713 // transforming path ``/xxx/one/yyy/one/zzz`` into ``/xxx/two/yyy/one/zzz``. 1714 // 1715 // * The pattern ``(?i)/xxx/`` paired with a substitution string of ``/yyy/`` 1716 // would do a case-insensitive match and transform path ``/aaa/XxX/bbb`` to 1717 // ``/aaa/yyy/bbb``. 1718 type.matcher.v3.RegexMatchAndSubstitute regex_rewrite = 9; 1719 } 1720 1721 // The HTTP status code to use in the redirect response. The default response 1722 // code is MOVED_PERMANENTLY (301). 1723 RedirectResponseCode response_code = 3 [(validate.rules).enum = {defined_only: true}]; 1724 1725 // Indicates that during redirection, the query portion of the URL will 1726 // be removed. Default value is false. 1727 bool strip_query = 6; 1728} 1729 1730message DirectResponseAction { 1731 option (udpa.annotations.versioning).previous_message_type = 1732 "envoy.api.v2.route.DirectResponseAction"; 1733 1734 // Specifies the HTTP response status to be returned. 1735 uint32 status = 1 [(validate.rules).uint32 = {lt: 600 gte: 200}]; 1736 1737 // Specifies the content of the response body. If this setting is omitted, 1738 // no body is included in the generated response. 1739 // 1740 // .. note:: 1741 // 1742 // Headers can be specified using ``response_headers_to_add`` in the enclosing 1743 // :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` or 1744 // :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`. 1745 core.v3.DataSource body = 2; 1746} 1747 1748// [#not-implemented-hide:] 1749message NonForwardingAction { 1750} 1751 1752message Decorator { 1753 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.Decorator"; 1754 1755 // The operation name associated with the request matched to this route. If tracing is 1756 // enabled, this information will be used as the span name reported for this request. 1757 // 1758 // .. note:: 1759 // 1760 // For ingress (inbound) requests, or egress (outbound) responses, this value may be overridden 1761 // by the :ref:`x-envoy-decorator-operation 1762 // <config_http_filters_router_x-envoy-decorator-operation>` header. 1763 string operation = 1 [(validate.rules).string = {min_len: 1}]; 1764 1765 // Whether the decorated details should be propagated to the other party. The default is true. 1766 google.protobuf.BoolValue propagate = 2; 1767} 1768 1769message Tracing { 1770 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.Tracing"; 1771 1772 // Target percentage of requests managed by this HTTP connection manager that will be force 1773 // traced if the :ref:`x-client-trace-id <config_http_conn_man_headers_x-client-trace-id>` 1774 // header is set. This field is a direct analog for the runtime variable 1775 // 'tracing.client_enabled' in the :ref:`HTTP Connection Manager 1776 // <config_http_conn_man_runtime>`. 1777 // Default: 100% 1778 type.v3.FractionalPercent client_sampling = 1; 1779 1780 // Target percentage of requests managed by this HTTP connection manager that will be randomly 1781 // selected for trace generation, if not requested by the client or not forced. This field is 1782 // a direct analog for the runtime variable 'tracing.random_sampling' in the 1783 // :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`. 1784 // Default: 100% 1785 type.v3.FractionalPercent random_sampling = 2; 1786 1787 // Target percentage of requests managed by this HTTP connection manager that will be traced 1788 // after all other sampling checks have been applied (client-directed, force tracing, random 1789 // sampling). This field functions as an upper limit on the total configured sampling rate. For 1790 // instance, setting client_sampling to 100% but overall_sampling to 1% will result in only 1% 1791 // of client requests with the appropriate headers to be force traced. This field is a direct 1792 // analog for the runtime variable 'tracing.global_enabled' in the 1793 // :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`. 1794 // Default: 100% 1795 type.v3.FractionalPercent overall_sampling = 3; 1796 1797 // A list of custom tags with unique tag name to create tags for the active span. 1798 // It will take effect after merging with the :ref:`corresponding configuration 1799 // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.Tracing.custom_tags>` 1800 // configured in the HTTP connection manager. If two tags with the same name are configured 1801 // each in the HTTP connection manager and the route level, the one configured here takes 1802 // priority. 1803 repeated type.tracing.v3.CustomTag custom_tags = 4; 1804} 1805 1806// A virtual cluster is a way of specifying a regex matching rule against 1807// certain important endpoints such that statistics are generated explicitly for 1808// the matched requests. The reason this is useful is that when doing 1809// prefix/path matching Envoy does not always know what the application 1810// considers to be an endpoint. Thus, it’s impossible for Envoy to generically 1811// emit per endpoint statistics. However, often systems have highly critical 1812// endpoints that they wish to get “perfect” statistics on. Virtual cluster 1813// statistics are perfect in the sense that they are emitted on the downstream 1814// side such that they include network level failures. 1815// 1816// Documentation for :ref:`virtual cluster statistics <config_http_filters_router_vcluster_stats>`. 1817// 1818// .. note:: 1819// 1820// Virtual clusters are a useful tool, but we do not recommend setting up a virtual cluster for 1821// every application endpoint. This is both not easily maintainable and as well the matching and 1822// statistics output are not free. 1823message VirtualCluster { 1824 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.VirtualCluster"; 1825 1826 reserved 1, 3; 1827 1828 reserved "pattern", "method"; 1829 1830 // Specifies a list of header matchers to use for matching requests. Each specified header must 1831 // match. The pseudo-headers ``:path`` and ``:method`` can be used to match the request path and 1832 // method, respectively. 1833 repeated HeaderMatcher headers = 4; 1834 1835 // Specifies the name of the virtual cluster. The virtual cluster name as well 1836 // as the virtual host name are used when emitting statistics. The statistics are emitted by the 1837 // router filter and are documented :ref:`here <config_http_filters_router_stats>`. 1838 string name = 2 [(validate.rules).string = {min_len: 1}]; 1839} 1840 1841// Global rate limiting :ref:`architecture overview <arch_overview_global_rate_limit>`. 1842// Also applies to Local rate limiting :ref:`using descriptors <config_http_filters_local_rate_limit_descriptors>`. 1843message RateLimit { 1844 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.RateLimit"; 1845 1846 // [#next-free-field: 12] 1847 message Action { 1848 option (udpa.annotations.versioning).previous_message_type = 1849 "envoy.api.v2.route.RateLimit.Action"; 1850 1851 // The following descriptor entry is appended to the descriptor: 1852 // 1853 // .. code-block:: cpp 1854 // 1855 // ("source_cluster", "<local service cluster>") 1856 // 1857 // <local service cluster> is derived from the :option:`--service-cluster` option. 1858 message SourceCluster { 1859 option (udpa.annotations.versioning).previous_message_type = 1860 "envoy.api.v2.route.RateLimit.Action.SourceCluster"; 1861 } 1862 1863 // The following descriptor entry is appended to the descriptor: 1864 // 1865 // .. code-block:: cpp 1866 // 1867 // ("destination_cluster", "<routed target cluster>") 1868 // 1869 // Once a request matches against a route table rule, a routed cluster is determined by one of 1870 // the following :ref:`route table configuration <envoy_v3_api_msg_config.route.v3.RouteConfiguration>` 1871 // settings: 1872 // 1873 // * :ref:`cluster <envoy_v3_api_field_config.route.v3.RouteAction.cluster>` indicates the upstream cluster 1874 // to route to. 1875 // * :ref:`weighted_clusters <envoy_v3_api_field_config.route.v3.RouteAction.weighted_clusters>` 1876 // chooses a cluster randomly from a set of clusters with attributed weight. 1877 // * :ref:`cluster_header <envoy_v3_api_field_config.route.v3.RouteAction.cluster_header>` indicates which 1878 // header in the request contains the target cluster. 1879 message DestinationCluster { 1880 option (udpa.annotations.versioning).previous_message_type = 1881 "envoy.api.v2.route.RateLimit.Action.DestinationCluster"; 1882 } 1883 1884 // The following descriptor entry is appended when a header contains a key that matches the 1885 // ``header_name``: 1886 // 1887 // .. code-block:: cpp 1888 // 1889 // ("<descriptor_key>", "<header_value_queried_from_header>") 1890 message RequestHeaders { 1891 option (udpa.annotations.versioning).previous_message_type = 1892 "envoy.api.v2.route.RateLimit.Action.RequestHeaders"; 1893 1894 // The header name to be queried from the request headers. The header’s 1895 // value is used to populate the value of the descriptor entry for the 1896 // descriptor_key. 1897 string header_name = 1 1898 [(validate.rules).string = {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}]; 1899 1900 // The key to use in the descriptor entry. 1901 string descriptor_key = 2 [(validate.rules).string = {min_len: 1}]; 1902 1903 // If set to true, Envoy skips the descriptor while calling rate limiting service 1904 // when header is not present in the request. By default it skips calling the 1905 // rate limiting service if this header is not present in the request. 1906 bool skip_if_absent = 3; 1907 } 1908 1909 // The following descriptor entry is appended to the descriptor and is populated using the 1910 // trusted address from :ref:`x-forwarded-for <config_http_conn_man_headers_x-forwarded-for>`: 1911 // 1912 // .. code-block:: cpp 1913 // 1914 // ("remote_address", "<trusted address from x-forwarded-for>") 1915 message RemoteAddress { 1916 option (udpa.annotations.versioning).previous_message_type = 1917 "envoy.api.v2.route.RateLimit.Action.RemoteAddress"; 1918 } 1919 1920 // The following descriptor entry is appended to the descriptor and is populated using the 1921 // masked address from :ref:`x-forwarded-for <config_http_conn_man_headers_x-forwarded-for>`: 1922 // 1923 // .. code-block:: cpp 1924 // 1925 // ("masked_remote_address", "<masked address from x-forwarded-for>") 1926 message MaskedRemoteAddress { 1927 // Length of prefix mask len for IPv4 (e.g. 0, 32). 1928 // Defaults to 32 when unset. 1929 // For example, trusted address from x-forwarded-for is ``192.168.1.1``, 1930 // the descriptor entry is ("masked_remote_address", "192.168.1.1/32"); 1931 // if mask len is 24, the descriptor entry is ("masked_remote_address", "192.168.1.0/24"). 1932 google.protobuf.UInt32Value v4_prefix_mask_len = 1 [(validate.rules).uint32 = {lte: 32}]; 1933 1934 // Length of prefix mask len for IPv6 (e.g. 0, 128). 1935 // Defaults to 128 when unset. 1936 // For example, trusted address from x-forwarded-for is ``2001:abcd:ef01:2345:6789:abcd:ef01:234``, 1937 // the descriptor entry is ("masked_remote_address", "2001:abcd:ef01:2345:6789:abcd:ef01:234/128"); 1938 // if mask len is 64, the descriptor entry is ("masked_remote_address", "2001:abcd:ef01:2345::/64"). 1939 google.protobuf.UInt32Value v6_prefix_mask_len = 2 [(validate.rules).uint32 = {lte: 128}]; 1940 } 1941 1942 // The following descriptor entry is appended to the descriptor: 1943 // 1944 // .. code-block:: cpp 1945 // 1946 // ("generic_key", "<descriptor_value>") 1947 message GenericKey { 1948 option (udpa.annotations.versioning).previous_message_type = 1949 "envoy.api.v2.route.RateLimit.Action.GenericKey"; 1950 1951 // The value to use in the descriptor entry. 1952 string descriptor_value = 1 [(validate.rules).string = {min_len: 1}]; 1953 1954 // An optional key to use in the descriptor entry. If not set it defaults 1955 // to 'generic_key' as the descriptor key. 1956 string descriptor_key = 2; 1957 } 1958 1959 // The following descriptor entry is appended to the descriptor: 1960 // 1961 // .. code-block:: cpp 1962 // 1963 // ("header_match", "<descriptor_value>") 1964 message HeaderValueMatch { 1965 option (udpa.annotations.versioning).previous_message_type = 1966 "envoy.api.v2.route.RateLimit.Action.HeaderValueMatch"; 1967 1968 // The key to use in the descriptor entry. Defaults to ``header_match``. 1969 string descriptor_key = 4; 1970 1971 // The value to use in the descriptor entry. 1972 string descriptor_value = 1 [(validate.rules).string = {min_len: 1}]; 1973 1974 // If set to true, the action will append a descriptor entry when the 1975 // request matches the headers. If set to false, the action will append a 1976 // descriptor entry when the request does not match the headers. The 1977 // default value is true. 1978 google.protobuf.BoolValue expect_match = 2; 1979 1980 // Specifies a set of headers that the rate limit action should match 1981 // on. The action will check the request’s headers against all the 1982 // specified headers in the config. A match will happen if all the 1983 // headers in the config are present in the request with the same values 1984 // (or based on presence if the value field is not in the config). 1985 repeated HeaderMatcher headers = 3 [(validate.rules).repeated = {min_items: 1}]; 1986 } 1987 1988 // The following descriptor entry is appended when the 1989 // :ref:`dynamic metadata <well_known_dynamic_metadata>` contains a key value: 1990 // 1991 // .. code-block:: cpp 1992 // 1993 // ("<descriptor_key>", "<value_queried_from_dynamic_metadata>") 1994 // 1995 // .. attention:: 1996 // This action has been deprecated in favor of the :ref:`metadata <envoy_v3_api_msg_config.route.v3.RateLimit.Action.MetaData>` action 1997 message DynamicMetaData { 1998 // The key to use in the descriptor entry. 1999 string descriptor_key = 1 [(validate.rules).string = {min_len: 1}]; 2000 2001 // Metadata struct that defines the key and path to retrieve the string value. A match will 2002 // only happen if the value in the dynamic metadata is of type string. 2003 type.metadata.v3.MetadataKey metadata_key = 2 [(validate.rules).message = {required: true}]; 2004 2005 // An optional value to use if ``metadata_key`` is empty. If not set and 2006 // no value is present under the metadata_key then no descriptor is generated. 2007 string default_value = 3; 2008 } 2009 2010 // The following descriptor entry is appended when the metadata contains a key value: 2011 // 2012 // .. code-block:: cpp 2013 // 2014 // ("<descriptor_key>", "<value_queried_from_metadata>") 2015 // [#next-free-field: 6] 2016 message MetaData { 2017 enum Source { 2018 // Query :ref:`dynamic metadata <well_known_dynamic_metadata>` 2019 DYNAMIC = 0; 2020 2021 // Query :ref:`route entry metadata <envoy_v3_api_field_config.route.v3.Route.metadata>` 2022 ROUTE_ENTRY = 1; 2023 } 2024 2025 // The key to use in the descriptor entry. 2026 string descriptor_key = 1 [(validate.rules).string = {min_len: 1}]; 2027 2028 // Metadata struct that defines the key and path to retrieve the string value. A match will 2029 // only happen if the value in the metadata is of type string. 2030 type.metadata.v3.MetadataKey metadata_key = 2 [(validate.rules).message = {required: true}]; 2031 2032 // An optional value to use if ``metadata_key`` is empty. If not set and 2033 // no value is present under the metadata_key then ``skip_if_absent`` is followed to 2034 // skip calling the rate limiting service or skip the descriptor. 2035 string default_value = 3; 2036 2037 // Source of metadata 2038 Source source = 4 [(validate.rules).enum = {defined_only: true}]; 2039 2040 // If set to true, Envoy skips the descriptor while calling rate limiting service 2041 // when ``metadata_key`` is empty and ``default_value`` is not set. By default it skips calling the 2042 // rate limiting service in that case. 2043 bool skip_if_absent = 5; 2044 } 2045 2046 // The following descriptor entry is appended to the descriptor: 2047 // 2048 // .. code-block:: cpp 2049 // 2050 // ("query_match", "<descriptor_value>") 2051 message QueryParameterValueMatch { 2052 // The key to use in the descriptor entry. Defaults to ``query_match``. 2053 string descriptor_key = 4; 2054 2055 // The value to use in the descriptor entry. 2056 string descriptor_value = 1 [(validate.rules).string = {min_len: 1}]; 2057 2058 // If set to true, the action will append a descriptor entry when the 2059 // request matches the headers. If set to false, the action will append a 2060 // descriptor entry when the request does not match the headers. The 2061 // default value is true. 2062 google.protobuf.BoolValue expect_match = 2; 2063 2064 // Specifies a set of query parameters that the rate limit action should match 2065 // on. The action will check the request’s query parameters against all the 2066 // specified query parameters in the config. A match will happen if all the 2067 // query parameters in the config are present in the request with the same values 2068 // (or based on presence if the value field is not in the config). 2069 repeated QueryParameterMatcher query_parameters = 3 2070 [(validate.rules).repeated = {min_items: 1}]; 2071 } 2072 2073 oneof action_specifier { 2074 option (validate.required) = true; 2075 2076 // Rate limit on source cluster. 2077 SourceCluster source_cluster = 1; 2078 2079 // Rate limit on destination cluster. 2080 DestinationCluster destination_cluster = 2; 2081 2082 // Rate limit on request headers. 2083 RequestHeaders request_headers = 3; 2084 2085 // Rate limit on remote address. 2086 RemoteAddress remote_address = 4; 2087 2088 // Rate limit on a generic key. 2089 GenericKey generic_key = 5; 2090 2091 // Rate limit on the existence of request headers. 2092 HeaderValueMatch header_value_match = 6; 2093 2094 // Rate limit on dynamic metadata. 2095 // 2096 // .. attention:: 2097 // This field has been deprecated in favor of the :ref:`metadata <envoy_v3_api_field_config.route.v3.RateLimit.Action.metadata>` field 2098 DynamicMetaData dynamic_metadata = 7 [ 2099 deprecated = true, 2100 (envoy.annotations.deprecated_at_minor_version) = "3.0", 2101 (envoy.annotations.disallowed_by_default) = true 2102 ]; 2103 2104 // Rate limit on metadata. 2105 MetaData metadata = 8; 2106 2107 // Rate limit descriptor extension. See the rate limit descriptor extensions documentation. 2108 // 2109 // :ref:`HTTP matching input functions <arch_overview_matching_api>` are 2110 // permitted as descriptor extensions. The input functions are only 2111 // looked up if there is no rate limit descriptor extension matching 2112 // the type URL. 2113 // 2114 // [#extension-category: envoy.rate_limit_descriptors] 2115 core.v3.TypedExtensionConfig extension = 9; 2116 2117 // Rate limit on masked remote address. 2118 MaskedRemoteAddress masked_remote_address = 10; 2119 2120 // Rate limit on the existence of query parameters. 2121 QueryParameterValueMatch query_parameter_value_match = 11; 2122 } 2123 } 2124 2125 message Override { 2126 // Fetches the override from the dynamic metadata. 2127 message DynamicMetadata { 2128 // Metadata struct that defines the key and path to retrieve the struct value. 2129 // The value must be a struct containing an integer "requests_per_unit" property 2130 // and a "unit" property with a value parseable to :ref:`RateLimitUnit 2131 // enum <envoy_v3_api_enum_type.v3.RateLimitUnit>` 2132 type.metadata.v3.MetadataKey metadata_key = 1 [(validate.rules).message = {required: true}]; 2133 } 2134 2135 oneof override_specifier { 2136 option (validate.required) = true; 2137 2138 // Limit override from dynamic metadata. 2139 DynamicMetadata dynamic_metadata = 1; 2140 } 2141 } 2142 2143 // Refers to the stage set in the filter. The rate limit configuration only 2144 // applies to filters with the same stage number. The default stage number is 2145 // 0. 2146 // 2147 // .. note:: 2148 // 2149 // The filter supports a range of 0 - 10 inclusively for stage numbers. 2150 google.protobuf.UInt32Value stage = 1 [(validate.rules).uint32 = {lte: 10}]; 2151 2152 // The key to be set in runtime to disable this rate limit configuration. 2153 string disable_key = 2; 2154 2155 // A list of actions that are to be applied for this rate limit configuration. 2156 // Order matters as the actions are processed sequentially and the descriptor 2157 // is composed by appending descriptor entries in that sequence. If an action 2158 // cannot append a descriptor entry, no descriptor is generated for the 2159 // configuration. See :ref:`composing actions 2160 // <config_http_filters_rate_limit_composing_actions>` for additional documentation. 2161 repeated Action actions = 3 [(validate.rules).repeated = {min_items: 1}]; 2162 2163 // An optional limit override to be appended to the descriptor produced by this 2164 // rate limit configuration. If the override value is invalid or cannot be resolved 2165 // from metadata, no override is provided. See :ref:`rate limit override 2166 // <config_http_filters_rate_limit_rate_limit_override>` for more information. 2167 Override limit = 4; 2168} 2169 2170// .. attention:: 2171// 2172// Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 ``Host`` 2173// header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. 2174// 2175// .. attention:: 2176// 2177// To route on HTTP method, use the special HTTP/2 ``:method`` header. This works for both 2178// HTTP/1 and HTTP/2 as Envoy normalizes headers. E.g., 2179// 2180// .. code-block:: json 2181// 2182// { 2183// "name": ":method", 2184// "string_match": { 2185// "exact": "POST" 2186// } 2187// } 2188// 2189// .. attention:: 2190// In the absence of any header match specifier, match will default to :ref:`present_match 2191// <envoy_v3_api_field_config.route.v3.HeaderMatcher.present_match>`. i.e, a request that has the :ref:`name 2192// <envoy_v3_api_field_config.route.v3.HeaderMatcher.name>` header will match, regardless of the header's 2193// value. 2194// 2195// [#next-major-version: HeaderMatcher should be refactored to use StringMatcher.] 2196// [#next-free-field: 15] 2197message HeaderMatcher { 2198 option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.HeaderMatcher"; 2199 2200 reserved 2, 3, 5; 2201 2202 reserved "regex_match"; 2203 2204 // Specifies the name of the header in the request. 2205 string name = 1 2206 [(validate.rules).string = {min_len: 1 well_known_regex: HTTP_HEADER_NAME strict: false}]; 2207 2208 // Specifies how the header match will be performed to route the request. 2209 oneof header_match_specifier { 2210 // If specified, header match will be performed based on the value of the header. 2211 // This field is deprecated. Please use :ref:`string_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.string_match>`. 2212 string exact_match = 4 2213 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 2214 2215 // If specified, this regex string is a regular expression rule which implies the entire request 2216 // header value must match the regex. The rule will not match if only a subsequence of the 2217 // request header value matches the regex. 2218 // This field is deprecated. Please use :ref:`string_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.string_match>`. 2219 type.matcher.v3.RegexMatcher safe_regex_match = 11 2220 [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; 2221 2222 // If specified, header match will be performed based on range. 2223 // The rule will match if the request header value is within this range. 2224 // The entire request header value must represent an integer in base 10 notation: consisting of 2225 // an optional plus or minus sign followed by a sequence of digits. The rule will not match if 2226 // the header value does not represent an integer. Match will fail for empty values, floating 2227 // point numbers or if only a subsequence of the header value is an integer. 2228 // 2229 // Examples: 2230 // 2231 // * For range [-10,0), route will match for header value -1, but not for 0, ``somestring``, 10.9, 2232 // ``-1somestring`` 2233 type.v3.Int64Range range_match = 6; 2234 2235 // If specified as true, header match will be performed based on whether the header is in the 2236 // request. If specified as false, header match will be performed based on whether the header is absent. 2237 bool present_match = 7; 2238 2239 // If specified, header match will be performed based on the prefix of the header value. 2240 // Note: empty prefix is not allowed, please use present_match instead. 2241 // This field is deprecated. Please use :ref:`string_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.string_match>`. 2242 // 2243 // Examples: 2244 // 2245 // * The prefix ``abcd`` matches the value ``abcdxyz``, but not for ``abcxyz``. 2246 string prefix_match = 9 [ 2247 deprecated = true, 2248 (validate.rules).string = {min_len: 1}, 2249 (envoy.annotations.deprecated_at_minor_version) = "3.0" 2250 ]; 2251 2252 // If specified, header match will be performed based on the suffix of the header value. 2253 // Note: empty suffix is not allowed, please use present_match instead. 2254 // This field is deprecated. Please use :ref:`string_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.string_match>`. 2255 // 2256 // Examples: 2257 // 2258 // * The suffix ``abcd`` matches the value ``xyzabcd``, but not for ``xyzbcd``. 2259 string suffix_match = 10 [ 2260 deprecated = true, 2261 (validate.rules).string = {min_len: 1}, 2262 (envoy.annotations.deprecated_at_minor_version) = "3.0" 2263 ]; 2264 2265 // If specified, header match will be performed based on whether the header value contains 2266 // the given value or not. 2267 // Note: empty contains match is not allowed, please use present_match instead. 2268 // This field is deprecated. Please use :ref:`string_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.string_match>`. 2269 // 2270 // Examples: 2271 // 2272 // * The value ``abcd`` matches the value ``xyzabcdpqr``, but not for ``xyzbcdpqr``. 2273 string contains_match = 12 [ 2274 deprecated = true, 2275 (validate.rules).string = {min_len: 1}, 2276 (envoy.annotations.deprecated_at_minor_version) = "3.0" 2277 ]; 2278 2279 // If specified, header match will be performed based on the string match of the header value. 2280 type.matcher.v3.StringMatcher string_match = 13; 2281 } 2282 2283 // If specified, the match result will be inverted before checking. Defaults to false. 2284 // 2285 // Examples: 2286 // 2287 // * The regex ``\d{3}`` does not match the value ``1234``, so it will match when inverted. 2288 // * The range [-10,0) will match the value -1, so it will not match when inverted. 2289 bool invert_match = 8; 2290 2291 // If specified, for any header match rule, if the header match rule specified header 2292 // does not exist, this header value will be treated as empty. Defaults to false. 2293 // 2294 // Examples: 2295 // 2296 // * The header match rule specified header "header1" to range match of [0, 10], 2297 // :ref:`invert_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.invert_match>` 2298 // is set to true and :ref:`treat_missing_header_as_empty <envoy_v3_api_field_config.route.v3.HeaderMatcher.treat_missing_header_as_empty>` 2299 // is set to true; The "header1" header is not present. The match rule will 2300 // treat the "header1" as an empty header. The empty header does not match the range, 2301 // so it will match when inverted. 2302 // * The header match rule specified header "header2" to range match of [0, 10], 2303 // :ref:`invert_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.invert_match>` 2304 // is set to true and :ref:`treat_missing_header_as_empty <envoy_v3_api_field_config.route.v3.HeaderMatcher.treat_missing_header_as_empty>` 2305 // is set to false; The "header2" header is not present and the header 2306 // matcher rule for "header2" will be ignored so it will not match. 2307 // * The header match rule specified header "header3" to a string regex match 2308 // ``^$`` which means an empty string, and 2309 // :ref:`treat_missing_header_as_empty <envoy_v3_api_field_config.route.v3.HeaderMatcher.treat_missing_header_as_empty>` 2310 // is set to true; The "header3" header is not present. 2311 // The match rule will treat the "header3" header as an empty header so it will match. 2312 // * The header match rule specified header "header4" to a string regex match 2313 // ``^$`` which means an empty string, and 2314 // :ref:`treat_missing_header_as_empty <envoy_v3_api_field_config.route.v3.HeaderMatcher.treat_missing_header_as_empty>` 2315 // is set to false; The "header4" header is not present. 2316 // The match rule for "header4" will be ignored so it will not match. 2317 bool treat_missing_header_as_empty = 14; 2318} 2319 2320// Query parameter matching treats the query string of a request's :path header 2321// as an ampersand-separated list of keys and/or key=value elements. 2322// [#next-free-field: 7] 2323message QueryParameterMatcher { 2324 option (udpa.annotations.versioning).previous_message_type = 2325 "envoy.api.v2.route.QueryParameterMatcher"; 2326 2327 reserved 3, 4; 2328 2329 reserved "value", "regex"; 2330 2331 // Specifies the name of a key that must be present in the requested 2332 // ``path``'s query string. 2333 string name = 1 [(validate.rules).string = {min_len: 1 max_bytes: 1024}]; 2334 2335 oneof query_parameter_match_specifier { 2336 // Specifies whether a query parameter value should match against a string. 2337 type.matcher.v3.StringMatcher string_match = 5 [(validate.rules).message = {required: true}]; 2338 2339 // Specifies whether a query parameter should be present. 2340 bool present_match = 6; 2341 } 2342} 2343 2344// HTTP Internal Redirect :ref:`architecture overview <arch_overview_internal_redirects>`. 2345message InternalRedirectPolicy { 2346 // An internal redirect is not handled, unless the number of previous internal redirects that a 2347 // downstream request has encountered is lower than this value. 2348 // In the case where a downstream request is bounced among multiple routes by internal redirect, 2349 // the first route that hits this threshold, or does not set :ref:`internal_redirect_policy 2350 // <envoy_v3_api_field_config.route.v3.RouteAction.internal_redirect_policy>` 2351 // will pass the redirect back to downstream. 2352 // 2353 // If not specified, at most one redirect will be followed. 2354 google.protobuf.UInt32Value max_internal_redirects = 1; 2355 2356 // Defines what upstream response codes are allowed to trigger internal redirect. If unspecified, 2357 // only 302 will be treated as internal redirect. 2358 // Only 301, 302, 303, 307 and 308 are valid values. Any other codes will be ignored. 2359 repeated uint32 redirect_response_codes = 2 [(validate.rules).repeated = {max_items: 5}]; 2360 2361 // Specifies a list of predicates that are queried when an upstream response is deemed 2362 // to trigger an internal redirect by all other criteria. Any predicate in the list can reject 2363 // the redirect, causing the response to be proxied to downstream. 2364 // [#extension-category: envoy.internal_redirect_predicates] 2365 repeated core.v3.TypedExtensionConfig predicates = 3; 2366 2367 // Allow internal redirect to follow a target URI with a different scheme than the value of 2368 // x-forwarded-proto. The default is false. 2369 bool allow_cross_scheme_redirect = 4; 2370} 2371 2372// A simple wrapper for an HTTP filter config. This is intended to be used as a wrapper for the 2373// map value in 2374// :ref:`VirtualHost.typed_per_filter_config<envoy_v3_api_field_config.route.v3.VirtualHost.typed_per_filter_config>`, 2375// :ref:`Route.typed_per_filter_config<envoy_v3_api_field_config.route.v3.Route.typed_per_filter_config>`, 2376// or :ref:`WeightedCluster.ClusterWeight.typed_per_filter_config<envoy_v3_api_field_config.route.v3.WeightedCluster.ClusterWeight.typed_per_filter_config>` 2377// to add additional flags to the filter. 2378// [#not-implemented-hide:] 2379message FilterConfig { 2380 // The filter config. 2381 google.protobuf.Any config = 1; 2382 2383 // If true, the filter is optional, meaning that if the client does 2384 // not support the specified filter, it may ignore the map entry rather 2385 // than rejecting the config. 2386 bool is_optional = 2; 2387 2388 // If true, the filter is disabled in the route or virtual host and the ``config`` field is ignored. 2389 // 2390 // .. note:: 2391 // 2392 // This field will take effect when the request arrive and filter chain is created for the request. 2393 // If initial route is selected for the request and a filter is disabled in the initial route, then 2394 // the filter will not be added to the filter chain. 2395 // And if the request is mutated later and re-match to another route, the disabled filter by the 2396 // initial route will not be added back to the filter chain because the filter chain is already 2397 // created and it is too late to change the chain. 2398 // 2399 // This field only make sense for the downstream HTTP filters for now. 2400 bool disabled = 3; 2401} 2402