route_components.proto 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629
  1. syntax = "proto3";
  2. package envoy.api.v2.route;
  3. import "envoy/api/v2/core/base.proto";
  4. import "envoy/type/matcher/regex.proto";
  5. import "envoy/type/matcher/string.proto";
  6. import "envoy/type/percent.proto";
  7. import "envoy/type/range.proto";
  8. import "envoy/type/tracing/v2/custom_tag.proto";
  9. import "google/protobuf/any.proto";
  10. import "google/protobuf/duration.proto";
  11. import "google/protobuf/struct.proto";
  12. import "google/protobuf/wrappers.proto";
  13. import "envoy/annotations/deprecation.proto";
  14. import "udpa/annotations/migrate.proto";
  15. import "udpa/annotations/status.proto";
  16. import "validate/validate.proto";
  17. option java_package = "io.envoyproxy.envoy.api.v2.route";
  18. option java_outer_classname = "RouteComponentsProto";
  19. option java_multiple_files = true;
  20. option go_package = "github.com/envoyproxy/go-control-plane/envoy/api/v2/route";
  21. option (udpa.annotations.file_migrate).move_to_package = "envoy.config.route.v3";
  22. option (udpa.annotations.file_status).package_version_status = FROZEN;
  23. // [#protodoc-title: HTTP route components]
  24. // * Routing :ref:`architecture overview <arch_overview_http_routing>`
  25. // * HTTP :ref:`router filter <config_http_filters_router>`
  26. // The top level element in the routing configuration is a virtual host. Each virtual host has
  27. // a logical name as well as a set of domains that get routed to it based on the incoming request's
  28. // host header. This allows a single listener to service multiple top level domain path trees. Once
  29. // a virtual host is selected based on the domain, the routes are processed in order to see which
  30. // upstream cluster to route to or whether to perform a redirect.
  31. // [#next-free-field: 21]
  32. message VirtualHost {
  33. enum TlsRequirementType {
  34. // No TLS requirement for the virtual host.
  35. NONE = 0;
  36. // External requests must use TLS. If a request is external and it is not
  37. // using TLS, a 301 redirect will be sent telling the client to use HTTPS.
  38. EXTERNAL_ONLY = 1;
  39. // All requests must use TLS. If a request is not using TLS, a 301 redirect
  40. // will be sent telling the client to use HTTPS.
  41. ALL = 2;
  42. }
  43. reserved 9;
  44. // The logical name of the virtual host. This is used when emitting certain
  45. // statistics but is not relevant for routing.
  46. string name = 1 [(validate.rules).string = {min_bytes: 1}];
  47. // A list of domains (host/authority header) that will be matched to this
  48. // virtual host. Wildcard hosts are supported in the suffix or prefix form.
  49. //
  50. // Domain search order:
  51. // 1. Exact domain names: ``www.foo.com``.
  52. // 2. Suffix domain wildcards: ``*.foo.com`` or ``*-bar.foo.com``.
  53. // 3. Prefix domain wildcards: ``foo.*`` or ``foo-*``.
  54. // 4. Special wildcard ``*`` matching any domain.
  55. //
  56. // .. note::
  57. //
  58. // The wildcard will not match the empty string.
  59. // e.g. ``*-bar.foo.com`` will match ``baz-bar.foo.com`` but not ``-bar.foo.com``.
  60. // The longest wildcards match first.
  61. // Only a single virtual host in the entire route configuration can match on ``*``. A domain
  62. // must be unique across all virtual hosts or the config will fail to load.
  63. //
  64. // Domains cannot contain control characters. This is validated by the well_known_regex HTTP_HEADER_VALUE.
  65. repeated string domains = 2 [(validate.rules).repeated = {
  66. min_items: 1
  67. items {string {well_known_regex: HTTP_HEADER_VALUE strict: false}}
  68. }];
  69. // The list of routes that will be matched, in order, for incoming requests.
  70. // The first route that matches will be used.
  71. repeated Route routes = 3;
  72. // Specifies the type of TLS enforcement the virtual host expects. If this option is not
  73. // specified, there is no TLS requirement for the virtual host.
  74. TlsRequirementType require_tls = 4 [(validate.rules).enum = {defined_only: true}];
  75. // A list of virtual clusters defined for this virtual host. Virtual clusters
  76. // are used for additional statistics gathering.
  77. repeated VirtualCluster virtual_clusters = 5;
  78. // Specifies a set of rate limit configurations that will be applied to the
  79. // virtual host.
  80. repeated RateLimit rate_limits = 6;
  81. // Specifies a list of HTTP headers that should be added to each request
  82. // handled by this virtual host. Headers specified at this level are applied
  83. // after headers from enclosed :ref:`envoy_api_msg_route.Route` and before headers from the
  84. // enclosing :ref:`envoy_api_msg_RouteConfiguration`. For more information, including
  85. // details on header value syntax, see the documentation on :ref:`custom request headers
  86. // <config_http_conn_man_headers_custom_request_headers>`.
  87. repeated core.HeaderValueOption request_headers_to_add = 7
  88. [(validate.rules).repeated = {max_items: 1000}];
  89. // Specifies a list of HTTP headers that should be removed from each request
  90. // handled by this virtual host.
  91. repeated string request_headers_to_remove = 13;
  92. // Specifies a list of HTTP headers that should be added to each response
  93. // handled by this virtual host. Headers specified at this level are applied
  94. // after headers from enclosed :ref:`envoy_api_msg_route.Route` and before headers from the
  95. // enclosing :ref:`envoy_api_msg_RouteConfiguration`. For more information, including
  96. // details on header value syntax, see the documentation on :ref:`custom request headers
  97. // <config_http_conn_man_headers_custom_request_headers>`.
  98. repeated core.HeaderValueOption response_headers_to_add = 10
  99. [(validate.rules).repeated = {max_items: 1000}];
  100. // Specifies a list of HTTP headers that should be removed from each response
  101. // handled by this virtual host.
  102. repeated string response_headers_to_remove = 11;
  103. // Indicates that the virtual host has a CORS policy.
  104. CorsPolicy cors = 8;
  105. // The per_filter_config field can be used to provide virtual host-specific
  106. // configurations for filters. The key should match the filter name, such as
  107. // *envoy.filters.http.buffer* for the HTTP buffer filter. Use of this field is filter
  108. // specific; see the :ref:`HTTP filter documentation <config_http_filters>`
  109. // for if and how it is utilized.
  110. map<string, google.protobuf.Struct> per_filter_config = 12 [deprecated = true];
  111. // The per_filter_config field can be used to provide virtual host-specific
  112. // configurations for filters. The key should match the filter name, such as
  113. // *envoy.filters.http.buffer* for the HTTP buffer filter. Use of this field is filter
  114. // specific; see the :ref:`HTTP filter documentation <config_http_filters>`
  115. // for if and how it is utilized.
  116. map<string, google.protobuf.Any> typed_per_filter_config = 15;
  117. // Decides whether the :ref:`x-envoy-attempt-count
  118. // <config_http_filters_router_x-envoy-attempt-count>` header should be included
  119. // in the upstream request. Setting this option will cause it to override any existing header
  120. // value, so in the case of two Envoys on the request path with this option enabled, the upstream
  121. // will see the attempt count as perceived by the second Envoy. Defaults to false.
  122. // This header is unaffected by the
  123. // :ref:`suppress_envoy_headers
  124. // <envoy_api_field_config.filter.http.router.v2.Router.suppress_envoy_headers>` flag.
  125. //
  126. // [#next-major-version: rename to include_attempt_count_in_request.]
  127. bool include_request_attempt_count = 14;
  128. // Decides whether the :ref:`x-envoy-attempt-count
  129. // <config_http_filters_router_x-envoy-attempt-count>` header should be included
  130. // in the downstream response. Setting this option will cause the router to override any existing header
  131. // value, so in the case of two Envoys on the request path with this option enabled, the downstream
  132. // will see the attempt count as perceived by the Envoy closest upstream from itself. Defaults to false.
  133. // This header is unaffected by the
  134. // :ref:`suppress_envoy_headers
  135. // <envoy_api_field_config.filter.http.router.v2.Router.suppress_envoy_headers>` flag.
  136. bool include_attempt_count_in_response = 19;
  137. // Indicates the retry policy for all routes in this virtual host. Note that setting a
  138. // route level entry will take precedence over this config and it'll be treated
  139. // independently (e.g.: values are not inherited).
  140. RetryPolicy retry_policy = 16;
  141. // [#not-implemented-hide:]
  142. // Specifies the configuration for retry policy extension. Note that setting a route level entry
  143. // will take precedence over this config and it'll be treated independently (e.g.: values are not
  144. // inherited). :ref:`Retry policy <envoy_api_field_route.VirtualHost.retry_policy>` should not be
  145. // set if this field is used.
  146. google.protobuf.Any retry_policy_typed_config = 20;
  147. // Indicates the hedge policy for all routes in this virtual host. Note that setting a
  148. // route level entry will take precedence over this config and it'll be treated
  149. // independently (e.g.: values are not inherited).
  150. HedgePolicy hedge_policy = 17;
  151. // The maximum bytes which will be buffered for retries and shadowing.
  152. // If set and a route-specific limit is not set, the bytes actually buffered will be the minimum
  153. // value of this and the listener per_connection_buffer_limit_bytes.
  154. google.protobuf.UInt32Value per_request_buffer_limit_bytes = 18;
  155. }
  156. // A filter-defined action type.
  157. message FilterAction {
  158. google.protobuf.Any action = 1;
  159. }
  160. // A route is both a specification of how to match a request as well as an indication of what to do
  161. // next (e.g., redirect, forward, rewrite, etc.).
  162. //
  163. // .. attention::
  164. //
  165. // Envoy supports routing on HTTP method via :ref:`header matching
  166. // <envoy_api_msg_route.HeaderMatcher>`.
  167. // [#next-free-field: 18]
  168. message Route {
  169. reserved 6;
  170. // Name for the route.
  171. string name = 14;
  172. // Route matching parameters.
  173. RouteMatch match = 1 [(validate.rules).message = {required: true}];
  174. oneof action {
  175. option (validate.required) = true;
  176. // Route request to some upstream cluster.
  177. RouteAction route = 2;
  178. // Return a redirect.
  179. RedirectAction redirect = 3;
  180. // Return an arbitrary HTTP response directly, without proxying.
  181. DirectResponseAction direct_response = 7;
  182. // [#not-implemented-hide:]
  183. // If true, a filter will define the action (e.g., it could dynamically generate the
  184. // RouteAction).
  185. FilterAction filter_action = 17;
  186. }
  187. // The Metadata field can be used to provide additional information
  188. // about the route. It can be used for configuration, stats, and logging.
  189. // The metadata should go under the filter namespace that will need it.
  190. // For instance, if the metadata is intended for the Router filter,
  191. // the filter name should be specified as *envoy.filters.http.router*.
  192. core.Metadata metadata = 4;
  193. // Decorator for the matched route.
  194. Decorator decorator = 5;
  195. // The per_filter_config field can be used to provide route-specific
  196. // configurations for filters. The key should match the filter name, such as
  197. // *envoy.filters.http.buffer* for the HTTP buffer filter. Use of this field is filter
  198. // specific; see the :ref:`HTTP filter documentation <config_http_filters>` for
  199. // if and how it is utilized.
  200. map<string, google.protobuf.Struct> per_filter_config = 8 [deprecated = true];
  201. // The typed_per_filter_config field can be used to provide route-specific
  202. // configurations for filters. The key should match the filter name, such as
  203. // *envoy.filters.http.buffer* for the HTTP buffer filter. Use of this field is filter
  204. // specific; see the :ref:`HTTP filter documentation <config_http_filters>` for
  205. // if and how it is utilized.
  206. map<string, google.protobuf.Any> typed_per_filter_config = 13;
  207. // Specifies a set of headers that will be added to requests matching this
  208. // route. Headers specified at this level are applied before headers from the
  209. // enclosing :ref:`envoy_api_msg_route.VirtualHost` and
  210. // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including details on
  211. // header value syntax, see the documentation on :ref:`custom request headers
  212. // <config_http_conn_man_headers_custom_request_headers>`.
  213. repeated core.HeaderValueOption request_headers_to_add = 9
  214. [(validate.rules).repeated = {max_items: 1000}];
  215. // Specifies a list of HTTP headers that should be removed from each request
  216. // matching this route.
  217. repeated string request_headers_to_remove = 12;
  218. // Specifies a set of headers that will be added to responses to requests
  219. // matching this route. Headers specified at this level are applied before
  220. // headers from the enclosing :ref:`envoy_api_msg_route.VirtualHost` and
  221. // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including
  222. // details on header value syntax, see the documentation on
  223. // :ref:`custom request headers <config_http_conn_man_headers_custom_request_headers>`.
  224. repeated core.HeaderValueOption response_headers_to_add = 10
  225. [(validate.rules).repeated = {max_items: 1000}];
  226. // Specifies a list of HTTP headers that should be removed from each response
  227. // to requests matching this route.
  228. repeated string response_headers_to_remove = 11;
  229. // Presence of the object defines whether the connection manager's tracing configuration
  230. // is overridden by this route specific instance.
  231. Tracing tracing = 15;
  232. // The maximum bytes which will be buffered for retries and shadowing.
  233. // If set, the bytes actually buffered will be the minimum value of this and the
  234. // listener per_connection_buffer_limit_bytes.
  235. google.protobuf.UInt32Value per_request_buffer_limit_bytes = 16;
  236. }
  237. // Compared to the :ref:`cluster <envoy_api_field_route.RouteAction.cluster>` field that specifies a
  238. // single upstream cluster as the target of a request, the :ref:`weighted_clusters
  239. // <envoy_api_field_route.RouteAction.weighted_clusters>` option allows for specification of
  240. // multiple upstream clusters along with weights that indicate the percentage of
  241. // traffic to be forwarded to each cluster. The router selects an upstream cluster based on the
  242. // weights.
  243. message WeightedCluster {
  244. // [#next-free-field: 11]
  245. message ClusterWeight {
  246. reserved 7;
  247. // Name of the upstream cluster. The cluster must exist in the
  248. // :ref:`cluster manager configuration <config_cluster_manager>`.
  249. string name = 1 [(validate.rules).string = {min_bytes: 1}];
  250. // An integer between 0 and :ref:`total_weight
  251. // <envoy_api_field_route.WeightedCluster.total_weight>`. When a request matches the route,
  252. // the choice of an upstream cluster is determined by its weight. The sum of weights across all
  253. // entries in the clusters array must add up to the total_weight, which defaults to 100.
  254. google.protobuf.UInt32Value weight = 2;
  255. // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints in
  256. // the upstream cluster with metadata matching what is set in this field will be considered for
  257. // load balancing. Note that this will be merged with what's provided in
  258. // :ref:`RouteAction.metadata_match <envoy_api_field_route.RouteAction.metadata_match>`, with
  259. // values here taking precedence. The filter name should be specified as *envoy.lb*.
  260. core.Metadata metadata_match = 3;
  261. // Specifies a list of headers to be added to requests when this cluster is selected
  262. // through the enclosing :ref:`envoy_api_msg_route.RouteAction`.
  263. // Headers specified at this level are applied before headers from the enclosing
  264. // :ref:`envoy_api_msg_route.Route`, :ref:`envoy_api_msg_route.VirtualHost`, and
  265. // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including details on
  266. // header value syntax, see the documentation on :ref:`custom request headers
  267. // <config_http_conn_man_headers_custom_request_headers>`.
  268. repeated core.HeaderValueOption request_headers_to_add = 4
  269. [(validate.rules).repeated = {max_items: 1000}];
  270. // Specifies a list of HTTP headers that should be removed from each request when
  271. // this cluster is selected through the enclosing :ref:`envoy_api_msg_route.RouteAction`.
  272. repeated string request_headers_to_remove = 9;
  273. // Specifies a list of headers to be added to responses when this cluster is selected
  274. // through the enclosing :ref:`envoy_api_msg_route.RouteAction`.
  275. // Headers specified at this level are applied before headers from the enclosing
  276. // :ref:`envoy_api_msg_route.Route`, :ref:`envoy_api_msg_route.VirtualHost`, and
  277. // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including details on
  278. // header value syntax, see the documentation on :ref:`custom request headers
  279. // <config_http_conn_man_headers_custom_request_headers>`.
  280. repeated core.HeaderValueOption response_headers_to_add = 5
  281. [(validate.rules).repeated = {max_items: 1000}];
  282. // Specifies a list of headers to be removed from responses when this cluster is selected
  283. // through the enclosing :ref:`envoy_api_msg_route.RouteAction`.
  284. repeated string response_headers_to_remove = 6;
  285. // The per_filter_config field can be used to provide weighted cluster-specific
  286. // configurations for filters. The key should match the filter name, such as
  287. // *envoy.filters.http.buffer* for the HTTP buffer filter. Use of this field is filter
  288. // specific; see the :ref:`HTTP filter documentation <config_http_filters>`
  289. // for if and how it is utilized.
  290. map<string, google.protobuf.Struct> per_filter_config = 8 [deprecated = true];
  291. // The per_filter_config field can be used to provide weighted cluster-specific
  292. // configurations for filters. The key should match the filter name, such as
  293. // *envoy.filters.http.buffer* for the HTTP buffer filter. Use of this field is filter
  294. // specific; see the :ref:`HTTP filter documentation <config_http_filters>`
  295. // for if and how it is utilized.
  296. map<string, google.protobuf.Any> typed_per_filter_config = 10;
  297. }
  298. // Specifies one or more upstream clusters associated with the route.
  299. repeated ClusterWeight clusters = 1 [(validate.rules).repeated = {min_items: 1}];
  300. // Specifies the total weight across all clusters. The sum of all cluster weights must equal this
  301. // value, which must be greater than 0. Defaults to 100.
  302. google.protobuf.UInt32Value total_weight = 3 [(validate.rules).uint32 = {gte: 1}];
  303. // Specifies the runtime key prefix that should be used to construct the
  304. // runtime keys associated with each cluster. When the *runtime_key_prefix* is
  305. // specified, the router will look for weights associated with each upstream
  306. // cluster under the key *runtime_key_prefix* + "." + *cluster[i].name* where
  307. // *cluster[i]* denotes an entry in the clusters array field. If the runtime
  308. // key for the cluster does not exist, the value specified in the
  309. // configuration file will be used as the default weight. See the :ref:`runtime documentation
  310. // <operations_runtime>` for how key names map to the underlying implementation.
  311. string runtime_key_prefix = 2;
  312. }
  313. // [#next-free-field: 12]
  314. message RouteMatch {
  315. message GrpcRouteMatchOptions {
  316. }
  317. message TlsContextMatchOptions {
  318. // If specified, the route will match against whether or not a certificate is presented.
  319. // If not specified, certificate presentation status (true or false) will not be considered when route matching.
  320. google.protobuf.BoolValue presented = 1;
  321. // If specified, the route will match against whether or not a certificate is validated.
  322. // If not specified, certificate validation status (true or false) will not be considered when route matching.
  323. google.protobuf.BoolValue validated = 2;
  324. }
  325. reserved 5;
  326. oneof path_specifier {
  327. option (validate.required) = true;
  328. // If specified, the route is a prefix rule meaning that the prefix must
  329. // match the beginning of the *:path* header.
  330. string prefix = 1;
  331. // If specified, the route is an exact path rule meaning that the path must
  332. // exactly match the *:path* header once the query string is removed.
  333. string path = 2;
  334. // If specified, the route is a regular expression rule meaning that the
  335. // regex must match the *:path* header once the query string is removed. The entire path
  336. // (without the query string) must match the regex. The rule will not match if only a
  337. // subsequence of the *:path* header matches the regex. The regex grammar is defined `here
  338. // <https://en.cppreference.com/w/cpp/regex/ecmascript>`_.
  339. //
  340. // Examples:
  341. //
  342. // * The regex ``/b[io]t`` matches the path */bit*
  343. // * The regex ``/b[io]t`` matches the path */bot*
  344. // * The regex ``/b[io]t`` does not match the path */bite*
  345. // * The regex ``/b[io]t`` does not match the path */bit/bot*
  346. //
  347. // .. attention::
  348. // This field has been deprecated in favor of `safe_regex` as it is not safe for use with
  349. // untrusted input in all cases.
  350. string regex = 3 [
  351. deprecated = true,
  352. (validate.rules).string = {max_bytes: 1024},
  353. (envoy.annotations.disallowed_by_default) = true
  354. ];
  355. // If specified, the route is a regular expression rule meaning that the
  356. // regex must match the *:path* header once the query string is removed. The entire path
  357. // (without the query string) must match the regex. The rule will not match if only a
  358. // subsequence of the *:path* header matches the regex.
  359. //
  360. // [#next-major-version: In the v3 API we should redo how path specification works such
  361. // that we utilize StringMatcher, and additionally have consistent options around whether we
  362. // strip query strings, do a case sensitive match, etc. In the interim it will be too disruptive
  363. // to deprecate the existing options. We should even consider whether we want to do away with
  364. // path_specifier entirely and just rely on a set of header matchers which can already match
  365. // on :path, etc. The issue with that is it is unclear how to generically deal with query string
  366. // stripping. This needs more thought.]
  367. type.matcher.RegexMatcher safe_regex = 10 [(validate.rules).message = {required: true}];
  368. }
  369. // Indicates that prefix/path matching should be case sensitive. The default
  370. // is true.
  371. google.protobuf.BoolValue case_sensitive = 4;
  372. // Indicates that the route should additionally match on a runtime key. Every time the route
  373. // is considered for a match, it must also fall under the percentage of matches indicated by
  374. // this field. For some fraction N/D, a random number in the range [0,D) is selected. If the
  375. // number is <= the value of the numerator N, or if the key is not present, the default
  376. // value, the router continues to evaluate the remaining match criteria. A runtime_fraction
  377. // route configuration can be used to roll out route changes in a gradual manner without full
  378. // code/config deploys. Refer to the :ref:`traffic shifting
  379. // <config_http_conn_man_route_table_traffic_splitting_shift>` docs for additional documentation.
  380. //
  381. // .. note::
  382. //
  383. // Parsing this field is implemented such that the runtime key's data may be represented
  384. // as a FractionalPercent proto represented as JSON/YAML and may also be represented as an
  385. // integer with the assumption that the value is an integral percentage out of 100. For
  386. // instance, a runtime key lookup returning the value "42" would parse as a FractionalPercent
  387. // whose numerator is 42 and denominator is HUNDRED. This preserves legacy semantics.
  388. core.RuntimeFractionalPercent runtime_fraction = 9;
  389. // Specifies a set of headers that the route should match on. The router will
  390. // check the request’s headers against all the specified headers in the route
  391. // config. A match will happen if all the headers in the route are present in
  392. // the request with the same values (or based on presence if the value field
  393. // is not in the config).
  394. repeated HeaderMatcher headers = 6;
  395. // Specifies a set of URL query parameters on which the route should
  396. // match. The router will check the query string from the *path* header
  397. // against all the specified query parameters. If the number of specified
  398. // query parameters is nonzero, they all must match the *path* header's
  399. // query string for a match to occur.
  400. repeated QueryParameterMatcher query_parameters = 7;
  401. // If specified, only gRPC requests will be matched. The router will check
  402. // that the content-type header has a application/grpc or one of the various
  403. // application/grpc+ values.
  404. GrpcRouteMatchOptions grpc = 8;
  405. // If specified, the client tls context will be matched against the defined
  406. // match options.
  407. //
  408. // [#next-major-version: unify with RBAC]
  409. TlsContextMatchOptions tls_context = 11;
  410. }
  411. // [#next-free-field: 12]
  412. message CorsPolicy {
  413. // Specifies the origins that will be allowed to do CORS requests.
  414. //
  415. // An origin is allowed if either allow_origin or allow_origin_regex match.
  416. //
  417. // .. attention::
  418. // This field has been deprecated in favor of `allow_origin_string_match`.
  419. repeated string allow_origin = 1
  420. [deprecated = true, (envoy.annotations.disallowed_by_default) = true];
  421. // Specifies regex patterns that match allowed origins.
  422. //
  423. // An origin is allowed if either allow_origin or allow_origin_regex match.
  424. //
  425. // .. attention::
  426. // This field has been deprecated in favor of `allow_origin_string_match` as it is not safe for
  427. // use with untrusted input in all cases.
  428. repeated string allow_origin_regex = 8
  429. [deprecated = true, (validate.rules).repeated = {items {string {max_bytes: 1024}}}];
  430. // Specifies string patterns that match allowed origins. An origin is allowed if any of the
  431. // string matchers match.
  432. repeated type.matcher.StringMatcher allow_origin_string_match = 11;
  433. // Specifies the content for the *access-control-allow-methods* header.
  434. string allow_methods = 2;
  435. // Specifies the content for the *access-control-allow-headers* header.
  436. string allow_headers = 3;
  437. // Specifies the content for the *access-control-expose-headers* header.
  438. string expose_headers = 4;
  439. // Specifies the content for the *access-control-max-age* header.
  440. string max_age = 5;
  441. // Specifies whether the resource allows credentials.
  442. google.protobuf.BoolValue allow_credentials = 6;
  443. oneof enabled_specifier {
  444. // Specifies if the CORS filter is enabled. Defaults to true. Only effective on route.
  445. //
  446. // .. attention::
  447. //
  448. // **This field is deprecated**. Set the
  449. // :ref:`filter_enabled<envoy_api_field_route.CorsPolicy.filter_enabled>` field instead.
  450. google.protobuf.BoolValue enabled = 7
  451. [deprecated = true, (envoy.annotations.disallowed_by_default) = true];
  452. // Specifies the % of requests for which the CORS filter is enabled.
  453. //
  454. // If neither ``enabled``, ``filter_enabled``, nor ``shadow_enabled`` are specified, the CORS
  455. // filter will be enabled for 100% of the requests.
  456. //
  457. // If :ref:`runtime_key <envoy_api_field_core.RuntimeFractionalPercent.runtime_key>` is
  458. // specified, Envoy will lookup the runtime key to get the percentage of requests to filter.
  459. core.RuntimeFractionalPercent filter_enabled = 9;
  460. }
  461. // Specifies the % of requests for which the CORS policies will be evaluated and tracked, but not
  462. // enforced.
  463. //
  464. // This field is intended to be used when ``filter_enabled`` and ``enabled`` are off. One of those
  465. // fields have to explicitly disable the filter in order for this setting to take effect.
  466. //
  467. // If :ref:`runtime_key <envoy_api_field_core.RuntimeFractionalPercent.runtime_key>` is specified,
  468. // Envoy will lookup the runtime key to get the percentage of requests for which it will evaluate
  469. // and track the request's *Origin* to determine if it's valid but will not enforce any policies.
  470. core.RuntimeFractionalPercent shadow_enabled = 10;
  471. }
  472. // [#next-free-field: 34]
  473. message RouteAction {
  474. enum ClusterNotFoundResponseCode {
  475. // HTTP status code - 503 Service Unavailable.
  476. SERVICE_UNAVAILABLE = 0;
  477. // HTTP status code - 404 Not Found.
  478. NOT_FOUND = 1;
  479. }
  480. // Configures :ref:`internal redirect <arch_overview_internal_redirects>` behavior.
  481. enum InternalRedirectAction {
  482. PASS_THROUGH_INTERNAL_REDIRECT = 0;
  483. HANDLE_INTERNAL_REDIRECT = 1;
  484. }
  485. // The router is capable of shadowing traffic from one cluster to another. The current
  486. // implementation is "fire and forget," meaning Envoy will not wait for the shadow cluster to
  487. // respond before returning the response from the primary cluster. All normal statistics are
  488. // collected for the shadow cluster making this feature useful for testing.
  489. //
  490. // During shadowing, the host/authority header is altered such that *-shadow* is appended. This is
  491. // useful for logging. For example, *cluster1* becomes *cluster1-shadow*.
  492. //
  493. // .. note::
  494. //
  495. // Shadowing will not be triggered if the primary cluster does not exist.
  496. message RequestMirrorPolicy {
  497. // Specifies the cluster that requests will be mirrored to. The cluster must
  498. // exist in the cluster manager configuration.
  499. string cluster = 1 [(validate.rules).string = {min_bytes: 1}];
  500. // If not specified, all requests to the target cluster will be mirrored. If
  501. // specified, Envoy will lookup the runtime key to get the % of requests to
  502. // mirror. Valid values are from 0 to 10000, allowing for increments of
  503. // 0.01% of requests to be mirrored. If the runtime key is specified in the
  504. // configuration but not present in runtime, 0 is the default and thus 0% of
  505. // requests will be mirrored.
  506. //
  507. // .. attention::
  508. //
  509. // **This field is deprecated**. Set the
  510. // :ref:`runtime_fraction
  511. // <envoy_api_field_route.RouteAction.RequestMirrorPolicy.runtime_fraction>`
  512. // field instead. Mirroring occurs if both this and
  513. // <envoy_api_field_route.RouteAction.RequestMirrorPolicy.runtime_fraction>`
  514. // are not set.
  515. string runtime_key = 2 [deprecated = true, (envoy.annotations.disallowed_by_default) = true];
  516. // If not specified, all requests to the target cluster will be mirrored.
  517. //
  518. // If specified, this field takes precedence over the `runtime_key` field and requests must also
  519. // fall under the percentage of matches indicated by this field.
  520. //
  521. // For some fraction N/D, a random number in the range [0,D) is selected. If the
  522. // number is <= the value of the numerator N, or if the key is not present, the default
  523. // value, the request will be mirrored.
  524. core.RuntimeFractionalPercent runtime_fraction = 3;
  525. // Determines if the trace span should be sampled. Defaults to true.
  526. google.protobuf.BoolValue trace_sampled = 4;
  527. }
  528. // Specifies the route's hashing policy if the upstream cluster uses a hashing :ref:`load balancer
  529. // <arch_overview_load_balancing_types>`.
  530. // [#next-free-field: 7]
  531. message HashPolicy {
  532. message Header {
  533. // The name of the request header that will be used to obtain the hash
  534. // key. If the request header is not present, no hash will be produced.
  535. string header_name = 1 [
  536. (validate.rules).string = {min_bytes: 1 well_known_regex: HTTP_HEADER_NAME strict: false}
  537. ];
  538. }
  539. // Envoy supports two types of cookie affinity:
  540. //
  541. // 1. Passive. Envoy takes a cookie that's present in the cookies header and
  542. // hashes on its value.
  543. //
  544. // 2. Generated. Envoy generates and sets a cookie with an expiration (TTL)
  545. // on the first request from the client in its response to the client,
  546. // based on the endpoint the request gets sent to. The client then
  547. // presents this on the next and all subsequent requests. The hash of
  548. // this is sufficient to ensure these requests get sent to the same
  549. // endpoint. The cookie is generated by hashing the source and
  550. // destination ports and addresses so that multiple independent HTTP2
  551. // streams on the same connection will independently receive the same
  552. // cookie, even if they arrive at the Envoy simultaneously.
  553. message Cookie {
  554. // The name of the cookie that will be used to obtain the hash key. If the
  555. // cookie is not present and ttl below is not set, no hash will be
  556. // produced.
  557. string name = 1 [(validate.rules).string = {min_bytes: 1}];
  558. // If specified, a cookie with the TTL will be generated if the cookie is
  559. // not present. If the TTL is present and zero, the generated cookie will
  560. // be a session cookie.
  561. google.protobuf.Duration ttl = 2;
  562. // The name of the path for the cookie. If no path is specified here, no path
  563. // will be set for the cookie.
  564. string path = 3;
  565. }
  566. message ConnectionProperties {
  567. // Hash on source IP address.
  568. bool source_ip = 1;
  569. }
  570. message QueryParameter {
  571. // The name of the URL query parameter that will be used to obtain the hash
  572. // key. If the parameter is not present, no hash will be produced. Query
  573. // parameter names are case-sensitive.
  574. string name = 1 [(validate.rules).string = {min_bytes: 1}];
  575. }
  576. message FilterState {
  577. // The name of the Object in the per-request filterState, which is an
  578. // Envoy::Hashable object. If there is no data associated with the key,
  579. // or the stored object is not Envoy::Hashable, no hash will be produced.
  580. string key = 1 [(validate.rules).string = {min_bytes: 1}];
  581. }
  582. oneof policy_specifier {
  583. option (validate.required) = true;
  584. // Header hash policy.
  585. Header header = 1;
  586. // Cookie hash policy.
  587. Cookie cookie = 2;
  588. // Connection properties hash policy.
  589. ConnectionProperties connection_properties = 3;
  590. // Query parameter hash policy.
  591. QueryParameter query_parameter = 5;
  592. // Filter state hash policy.
  593. FilterState filter_state = 6;
  594. }
  595. // The flag that short-circuits the hash computing. This field provides a
  596. // 'fallback' style of configuration: "if a terminal policy doesn't work,
  597. // fallback to rest of the policy list", it saves time when the terminal
  598. // policy works.
  599. //
  600. // If true, and there is already a hash computed, ignore rest of the
  601. // list of hash polices.
  602. // For example, if the following hash methods are configured:
  603. //
  604. // ========= ========
  605. // specifier terminal
  606. // ========= ========
  607. // Header A true
  608. // Header B false
  609. // Header C false
  610. // ========= ========
  611. //
  612. // The generateHash process ends if policy "header A" generates a hash, as
  613. // it's a terminal policy.
  614. bool terminal = 4;
  615. }
  616. // Allows enabling and disabling upgrades on a per-route basis.
  617. // This overrides any enabled/disabled upgrade filter chain specified in the
  618. // HttpConnectionManager
  619. // :ref:`upgrade_configs
  620. // <envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.upgrade_configs>`
  621. // but does not affect any custom filter chain specified there.
  622. message UpgradeConfig {
  623. // The case-insensitive name of this upgrade, e.g. "websocket".
  624. // For each upgrade type present in upgrade_configs, requests with
  625. // Upgrade: [upgrade_type] will be proxied upstream.
  626. string upgrade_type = 1
  627. [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];
  628. // Determines if upgrades are available on this route. Defaults to true.
  629. google.protobuf.BoolValue enabled = 2;
  630. }
  631. reserved 12, 18, 19, 16, 22, 21;
  632. oneof cluster_specifier {
  633. option (validate.required) = true;
  634. // Indicates the upstream cluster to which the request should be routed
  635. // to.
  636. string cluster = 1 [(validate.rules).string = {min_bytes: 1}];
  637. // Envoy will determine the cluster to route to by reading the value of the
  638. // HTTP header named by cluster_header from the request headers. If the
  639. // header is not found or the referenced cluster does not exist, Envoy will
  640. // return a 404 response.
  641. //
  642. // .. attention::
  643. //
  644. // Internally, Envoy always uses the HTTP/2 *:authority* header to represent the HTTP/1
  645. // *Host* header. Thus, if attempting to match on *Host*, match on *:authority* instead.
  646. //
  647. // .. note::
  648. //
  649. // If the header appears multiple times only the first value is used.
  650. string cluster_header = 2
  651. [(validate.rules).string = {min_bytes: 1 well_known_regex: HTTP_HEADER_NAME strict: false}];
  652. // Multiple upstream clusters can be specified for a given route. The
  653. // request is routed to one of the upstream clusters based on weights
  654. // assigned to each cluster. See
  655. // :ref:`traffic splitting <config_http_conn_man_route_table_traffic_splitting_split>`
  656. // for additional documentation.
  657. WeightedCluster weighted_clusters = 3;
  658. }
  659. // The HTTP status code to use when configured cluster is not found.
  660. // The default response code is 503 Service Unavailable.
  661. ClusterNotFoundResponseCode cluster_not_found_response_code = 20
  662. [(validate.rules).enum = {defined_only: true}];
  663. // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints
  664. // in the upstream cluster with metadata matching what's set in this field will be considered
  665. // for load balancing. If using :ref:`weighted_clusters
  666. // <envoy_api_field_route.RouteAction.weighted_clusters>`, metadata will be merged, with values
  667. // provided there taking precedence. The filter name should be specified as *envoy.lb*.
  668. core.Metadata metadata_match = 4;
  669. // Indicates that during forwarding, the matched prefix (or path) should be
  670. // swapped with this value. This option allows application URLs to be rooted
  671. // at a different path from those exposed at the reverse proxy layer. The router filter will
  672. // place the original path before rewrite into the :ref:`x-envoy-original-path
  673. // <config_http_filters_router_x-envoy-original-path>` header.
  674. //
  675. // Only one of *prefix_rewrite* or
  676. // :ref:`regex_rewrite <envoy_api_field_route.RouteAction.regex_rewrite>`
  677. // may be specified.
  678. //
  679. // .. attention::
  680. //
  681. // Pay careful attention to the use of trailing slashes in the
  682. // :ref:`route's match <envoy_api_field_route.Route.match>` prefix value.
  683. // Stripping a prefix from a path requires multiple Routes to handle all cases. For example,
  684. // rewriting */prefix* to */* and */prefix/etc* to */etc* cannot be done in a single
  685. // :ref:`Route <envoy_api_msg_route.Route>`, as shown by the below config entries:
  686. //
  687. // .. code-block:: yaml
  688. //
  689. // - match:
  690. // prefix: "/prefix/"
  691. // route:
  692. // prefix_rewrite: "/"
  693. // - match:
  694. // prefix: "/prefix"
  695. // route:
  696. // prefix_rewrite: "/"
  697. //
  698. // Having above entries in the config, requests to */prefix* will be stripped to */*, while
  699. // requests to */prefix/etc* will be stripped to */etc*.
  700. string prefix_rewrite = 5
  701. [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];
  702. // Indicates that during forwarding, portions of the path that match the
  703. // pattern should be rewritten, even allowing the substitution of capture
  704. // groups from the pattern into the new path as specified by the rewrite
  705. // substitution string. This is useful to allow application paths to be
  706. // rewritten in a way that is aware of segments with variable content like
  707. // identifiers. The router filter will place the original path as it was
  708. // before the rewrite into the :ref:`x-envoy-original-path
  709. // <config_http_filters_router_x-envoy-original-path>` header.
  710. //
  711. // Only one of :ref:`prefix_rewrite <envoy_api_field_route.RouteAction.prefix_rewrite>`
  712. // or *regex_rewrite* may be specified.
  713. //
  714. // Examples using Google's `RE2 <https://github.com/google/re2>`_ engine:
  715. //
  716. // * The path pattern ``^/service/([^/]+)(/.*)$`` paired with a substitution
  717. // string of ``\2/instance/\1`` would transform ``/service/foo/v1/api``
  718. // into ``/v1/api/instance/foo``.
  719. //
  720. // * The pattern ``one`` paired with a substitution string of ``two`` would
  721. // transform ``/xxx/one/yyy/one/zzz`` into ``/xxx/two/yyy/two/zzz``.
  722. //
  723. // * The pattern ``^(.*?)one(.*)$`` paired with a substitution string of
  724. // ``\1two\2`` would replace only the first occurrence of ``one``,
  725. // transforming path ``/xxx/one/yyy/one/zzz`` into ``/xxx/two/yyy/one/zzz``.
  726. //
  727. // * The pattern ``(?i)/xxx/`` paired with a substitution string of ``/yyy/``
  728. // would do a case-insensitive match and transform path ``/aaa/XxX/bbb`` to
  729. // ``/aaa/yyy/bbb``.
  730. type.matcher.RegexMatchAndSubstitute regex_rewrite = 32;
  731. oneof host_rewrite_specifier {
  732. // Indicates that during forwarding, the host header will be swapped with
  733. // this value.
  734. string host_rewrite = 6 [
  735. (validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false},
  736. (udpa.annotations.field_migrate).rename = "host_rewrite_literal"
  737. ];
  738. // Indicates that during forwarding, the host header will be swapped with
  739. // the hostname of the upstream host chosen by the cluster manager. This
  740. // option is applicable only when the destination cluster for a route is of
  741. // type *strict_dns* or *logical_dns*. Setting this to true with other cluster
  742. // types has no effect.
  743. google.protobuf.BoolValue auto_host_rewrite = 7;
  744. // Indicates that during forwarding, the host header will be swapped with the content of given
  745. // downstream or :ref:`custom <config_http_conn_man_headers_custom_request_headers>` header.
  746. // If header value is empty, host header is left intact.
  747. //
  748. // .. attention::
  749. //
  750. // Pay attention to the potential security implications of using this option. Provided header
  751. // must come from trusted source.
  752. //
  753. // .. note::
  754. //
  755. // If the header appears multiple times only the first value is used.
  756. string auto_host_rewrite_header = 29 [
  757. (validate.rules).string = {well_known_regex: HTTP_HEADER_NAME strict: false},
  758. (udpa.annotations.field_migrate).rename = "host_rewrite_header"
  759. ];
  760. }
  761. // Specifies the upstream timeout for the route. If not specified, the default is 15s. This
  762. // spans between the point at which the entire downstream request (i.e. end-of-stream) has been
  763. // processed and when the upstream response has been completely processed. A value of 0 will
  764. // disable the route's timeout.
  765. //
  766. // .. note::
  767. //
  768. // This timeout includes all retries. See also
  769. // :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`,
  770. // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms`, and the
  771. // :ref:`retry overview <arch_overview_http_routing_retry>`.
  772. google.protobuf.Duration timeout = 8;
  773. // Specifies the idle timeout for the route. If not specified, there is no per-route idle timeout,
  774. // although the connection manager wide :ref:`stream_idle_timeout
  775. // <envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.stream_idle_timeout>`
  776. // will still apply. A value of 0 will completely disable the route's idle timeout, even if a
  777. // connection manager stream idle timeout is configured.
  778. //
  779. // The idle timeout is distinct to :ref:`timeout
  780. // <envoy_api_field_route.RouteAction.timeout>`, which provides an upper bound
  781. // on the upstream response time; :ref:`idle_timeout
  782. // <envoy_api_field_route.RouteAction.idle_timeout>` instead bounds the amount
  783. // of time the request's stream may be idle.
  784. //
  785. // After header decoding, the idle timeout will apply on downstream and
  786. // upstream request events. Each time an encode/decode event for headers or
  787. // data is processed for the stream, the timer will be reset. If the timeout
  788. // fires, the stream is terminated with a 408 Request Timeout error code if no
  789. // upstream response header has been received, otherwise a stream reset
  790. // occurs.
  791. google.protobuf.Duration idle_timeout = 24;
  792. // Indicates that the route has a retry policy. Note that if this is set,
  793. // it'll take precedence over the virtual host level retry policy entirely
  794. // (e.g.: policies are not merged, most internal one becomes the enforced policy).
  795. RetryPolicy retry_policy = 9;
  796. // [#not-implemented-hide:]
  797. // Specifies the configuration for retry policy extension. Note that if this is set, it'll take
  798. // precedence over the virtual host level retry policy entirely (e.g.: policies are not merged,
  799. // most internal one becomes the enforced policy). :ref:`Retry policy <envoy_api_field_route.VirtualHost.retry_policy>`
  800. // should not be set if this field is used.
  801. google.protobuf.Any retry_policy_typed_config = 33;
  802. // Indicates that the route has a request mirroring policy.
  803. //
  804. // .. attention::
  805. // This field has been deprecated in favor of `request_mirror_policies` which supports one or
  806. // more mirroring policies.
  807. RequestMirrorPolicy request_mirror_policy = 10 [deprecated = true];
  808. // Indicates that the route has request mirroring policies.
  809. repeated RequestMirrorPolicy request_mirror_policies = 30;
  810. // Optionally specifies the :ref:`routing priority <arch_overview_http_routing_priority>`.
  811. core.RoutingPriority priority = 11 [(validate.rules).enum = {defined_only: true}];
  812. // Specifies a set of rate limit configurations that could be applied to the
  813. // route.
  814. repeated RateLimit rate_limits = 13;
  815. // Specifies if the rate limit filter should include the virtual host rate
  816. // limits. By default, if the route configured rate limits, the virtual host
  817. // :ref:`rate_limits <envoy_api_field_route.VirtualHost.rate_limits>` are not applied to the
  818. // request.
  819. google.protobuf.BoolValue include_vh_rate_limits = 14;
  820. // Specifies a list of hash policies to use for ring hash load balancing. Each
  821. // hash policy is evaluated individually and the combined result is used to
  822. // route the request. The method of combination is deterministic such that
  823. // identical lists of hash policies will produce the same hash. Since a hash
  824. // policy examines specific parts of a request, it can fail to produce a hash
  825. // (i.e. if the hashed header is not present). If (and only if) all configured
  826. // hash policies fail to generate a hash, no hash will be produced for
  827. // the route. In this case, the behavior is the same as if no hash policies
  828. // were specified (i.e. the ring hash load balancer will choose a random
  829. // backend). If a hash policy has the "terminal" attribute set to true, and
  830. // there is already a hash generated, the hash is returned immediately,
  831. // ignoring the rest of the hash policy list.
  832. repeated HashPolicy hash_policy = 15;
  833. // Indicates that the route has a CORS policy.
  834. CorsPolicy cors = 17;
  835. // If present, and the request is a gRPC request, use the
  836. // `grpc-timeout header <https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md>`_,
  837. // or its default value (infinity) instead of
  838. // :ref:`timeout <envoy_api_field_route.RouteAction.timeout>`, but limit the applied timeout
  839. // to the maximum value specified here. If configured as 0, the maximum allowed timeout for
  840. // gRPC requests is infinity. If not configured at all, the `grpc-timeout` header is not used
  841. // and gRPC requests time out like any other requests using
  842. // :ref:`timeout <envoy_api_field_route.RouteAction.timeout>` or its default.
  843. // This can be used to prevent unexpected upstream request timeouts due to potentially long
  844. // time gaps between gRPC request and response in gRPC streaming mode.
  845. //
  846. // .. note::
  847. //
  848. // If a timeout is specified using :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, it takes
  849. // precedence over `grpc-timeout header <https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md>`_, when
  850. // both are present. See also
  851. // :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`,
  852. // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms`, and the
  853. // :ref:`retry overview <arch_overview_http_routing_retry>`.
  854. google.protobuf.Duration max_grpc_timeout = 23;
  855. // If present, Envoy will adjust the timeout provided by the `grpc-timeout` header by subtracting
  856. // the provided duration from the header. This is useful in allowing Envoy to set its global
  857. // timeout to be less than that of the deadline imposed by the calling client, which makes it more
  858. // likely that Envoy will handle the timeout instead of having the call canceled by the client.
  859. // The offset will only be applied if the provided grpc_timeout is greater than the offset. This
  860. // ensures that the offset will only ever decrease the timeout and never set it to 0 (meaning
  861. // infinity).
  862. google.protobuf.Duration grpc_timeout_offset = 28;
  863. repeated UpgradeConfig upgrade_configs = 25;
  864. InternalRedirectAction internal_redirect_action = 26;
  865. // An internal redirect is handled, iff the number of previous internal redirects that a
  866. // downstream request has encountered is lower than this value, and
  867. // :ref:`internal_redirect_action <envoy_api_field_route.RouteAction.internal_redirect_action>`
  868. // is set to :ref:`HANDLE_INTERNAL_REDIRECT
  869. // <envoy_api_enum_value_route.RouteAction.InternalRedirectAction.HANDLE_INTERNAL_REDIRECT>`
  870. // In the case where a downstream request is bounced among multiple routes by internal redirect,
  871. // the first route that hits this threshold, or has
  872. // :ref:`internal_redirect_action <envoy_api_field_route.RouteAction.internal_redirect_action>`
  873. // set to
  874. // :ref:`PASS_THROUGH_INTERNAL_REDIRECT
  875. // <envoy_api_enum_value_route.RouteAction.InternalRedirectAction.PASS_THROUGH_INTERNAL_REDIRECT>`
  876. // will pass the redirect back to downstream.
  877. //
  878. // If not specified, at most one redirect will be followed.
  879. google.protobuf.UInt32Value max_internal_redirects = 31;
  880. // Indicates that the route has a hedge policy. Note that if this is set,
  881. // it'll take precedence over the virtual host level hedge policy entirely
  882. // (e.g.: policies are not merged, most internal one becomes the enforced policy).
  883. HedgePolicy hedge_policy = 27;
  884. }
  885. // HTTP retry :ref:`architecture overview <arch_overview_http_routing_retry>`.
  886. // [#next-free-field: 11]
  887. message RetryPolicy {
  888. message RetryPriority {
  889. string name = 1 [(validate.rules).string = {min_bytes: 1}];
  890. oneof config_type {
  891. google.protobuf.Struct config = 2 [deprecated = true];
  892. google.protobuf.Any typed_config = 3;
  893. }
  894. }
  895. message RetryHostPredicate {
  896. string name = 1 [(validate.rules).string = {min_bytes: 1}];
  897. oneof config_type {
  898. google.protobuf.Struct config = 2 [deprecated = true];
  899. google.protobuf.Any typed_config = 3;
  900. }
  901. }
  902. message RetryBackOff {
  903. // Specifies the base interval between retries. This parameter is required and must be greater
  904. // than zero. Values less than 1 ms are rounded up to 1 ms.
  905. // See :ref:`config_http_filters_router_x-envoy-max-retries` for a discussion of Envoy's
  906. // back-off algorithm.
  907. google.protobuf.Duration base_interval = 1 [(validate.rules).duration = {
  908. required: true
  909. gt {}
  910. }];
  911. // Specifies the maximum interval between retries. This parameter is optional, but must be
  912. // greater than or equal to the `base_interval` if set. The default is 10 times the
  913. // `base_interval`. See :ref:`config_http_filters_router_x-envoy-max-retries` for a discussion
  914. // of Envoy's back-off algorithm.
  915. google.protobuf.Duration max_interval = 2 [(validate.rules).duration = {gt {}}];
  916. }
  917. // Specifies the conditions under which retry takes place. These are the same
  918. // conditions documented for :ref:`config_http_filters_router_x-envoy-retry-on` and
  919. // :ref:`config_http_filters_router_x-envoy-retry-grpc-on`.
  920. string retry_on = 1;
  921. // Specifies the allowed number of retries. This parameter is optional and
  922. // defaults to 1. These are the same conditions documented for
  923. // :ref:`config_http_filters_router_x-envoy-max-retries`.
  924. google.protobuf.UInt32Value num_retries = 2;
  925. // Specifies a non-zero upstream timeout per retry attempt. This parameter is optional. The
  926. // same conditions documented for
  927. // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms` apply.
  928. //
  929. // .. note::
  930. //
  931. // If left unspecified, Envoy will use the global
  932. // :ref:`route timeout <envoy_api_field_route.RouteAction.timeout>` for the request.
  933. // Consequently, when using a :ref:`5xx <config_http_filters_router_x-envoy-retry-on>` based
  934. // retry policy, a request that times out will not be retried as the total timeout budget
  935. // would have been exhausted.
  936. google.protobuf.Duration per_try_timeout = 3;
  937. // Specifies an implementation of a RetryPriority which is used to determine the
  938. // distribution of load across priorities used for retries. Refer to
  939. // :ref:`retry plugin configuration <arch_overview_http_retry_plugins>` for more details.
  940. RetryPriority retry_priority = 4;
  941. // Specifies a collection of RetryHostPredicates that will be consulted when selecting a host
  942. // for retries. If any of the predicates reject the host, host selection will be reattempted.
  943. // Refer to :ref:`retry plugin configuration <arch_overview_http_retry_plugins>` for more
  944. // details.
  945. repeated RetryHostPredicate retry_host_predicate = 5;
  946. // The maximum number of times host selection will be reattempted before giving up, at which
  947. // point the host that was last selected will be routed to. If unspecified, this will default to
  948. // retrying once.
  949. int64 host_selection_retry_max_attempts = 6;
  950. // HTTP status codes that should trigger a retry in addition to those specified by retry_on.
  951. repeated uint32 retriable_status_codes = 7;
  952. // Specifies parameters that control retry back off. This parameter is optional, in which case the
  953. // default base interval is 25 milliseconds or, if set, the current value of the
  954. // `upstream.base_retry_backoff_ms` runtime parameter. The default maximum interval is 10 times
  955. // the base interval. The documentation for :ref:`config_http_filters_router_x-envoy-max-retries`
  956. // describes Envoy's back-off algorithm.
  957. RetryBackOff retry_back_off = 8;
  958. // HTTP response headers that trigger a retry if present in the response. A retry will be
  959. // triggered if any of the header matches match the upstream response headers.
  960. // The field is only consulted if 'retriable-headers' retry policy is active.
  961. repeated HeaderMatcher retriable_headers = 9;
  962. // HTTP headers which must be present in the request for retries to be attempted.
  963. repeated HeaderMatcher retriable_request_headers = 10;
  964. }
  965. // HTTP request hedging :ref:`architecture overview <arch_overview_http_routing_hedging>`.
  966. message HedgePolicy {
  967. // Specifies the number of initial requests that should be sent upstream.
  968. // Must be at least 1.
  969. // Defaults to 1.
  970. // [#not-implemented-hide:]
  971. google.protobuf.UInt32Value initial_requests = 1 [(validate.rules).uint32 = {gte: 1}];
  972. // Specifies a probability that an additional upstream request should be sent
  973. // on top of what is specified by initial_requests.
  974. // Defaults to 0.
  975. // [#not-implemented-hide:]
  976. type.FractionalPercent additional_request_chance = 2;
  977. // Indicates that a hedged request should be sent when the per-try timeout is hit.
  978. // This means that a retry will be issued without resetting the original request, leaving multiple upstream requests in flight.
  979. // The first request to complete successfully will be the one returned to the caller.
  980. //
  981. // * At any time, a successful response (i.e. not triggering any of the retry-on conditions) would be returned to the client.
  982. // * Before per-try timeout, an error response (per retry-on conditions) would be retried immediately or returned ot the client
  983. // if there are no more retries left.
  984. // * After per-try timeout, an error response would be discarded, as a retry in the form of a hedged request is already in progress.
  985. //
  986. // Note: For this to have effect, you must have a :ref:`RetryPolicy <envoy_api_msg_route.RetryPolicy>` that retries at least
  987. // one error code and specifies a maximum number of retries.
  988. //
  989. // Defaults to false.
  990. bool hedge_on_per_try_timeout = 3;
  991. }
  992. // [#next-free-field: 9]
  993. message RedirectAction {
  994. enum RedirectResponseCode {
  995. // Moved Permanently HTTP Status Code - 301.
  996. MOVED_PERMANENTLY = 0;
  997. // Found HTTP Status Code - 302.
  998. FOUND = 1;
  999. // See Other HTTP Status Code - 303.
  1000. SEE_OTHER = 2;
  1001. // Temporary Redirect HTTP Status Code - 307.
  1002. TEMPORARY_REDIRECT = 3;
  1003. // Permanent Redirect HTTP Status Code - 308.
  1004. PERMANENT_REDIRECT = 4;
  1005. }
  1006. // When the scheme redirection take place, the following rules apply:
  1007. // 1. If the source URI scheme is `http` and the port is explicitly
  1008. // set to `:80`, the port will be removed after the redirection
  1009. // 2. If the source URI scheme is `https` and the port is explicitly
  1010. // set to `:443`, the port will be removed after the redirection
  1011. oneof scheme_rewrite_specifier {
  1012. // The scheme portion of the URL will be swapped with "https".
  1013. bool https_redirect = 4;
  1014. // The scheme portion of the URL will be swapped with this value.
  1015. string scheme_redirect = 7;
  1016. }
  1017. // The host portion of the URL will be swapped with this value.
  1018. string host_redirect = 1
  1019. [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];
  1020. // The port value of the URL will be swapped with this value.
  1021. uint32 port_redirect = 8;
  1022. oneof path_rewrite_specifier {
  1023. // The path portion of the URL will be swapped with this value.
  1024. // Please note that query string in path_redirect will override the
  1025. // request's query string and will not be stripped.
  1026. //
  1027. // For example, let's say we have the following routes:
  1028. //
  1029. // - match: { path: "/old-path-1" }
  1030. // redirect: { path_redirect: "/new-path-1" }
  1031. // - match: { path: "/old-path-2" }
  1032. // redirect: { path_redirect: "/new-path-2", strip-query: "true" }
  1033. // - match: { path: "/old-path-3" }
  1034. // redirect: { path_redirect: "/new-path-3?foo=1", strip_query: "true" }
  1035. //
  1036. // 1. if request uri is "/old-path-1?bar=1", users will be redirected to "/new-path-1?bar=1"
  1037. // 2. if request uri is "/old-path-2?bar=1", users will be redirected to "/new-path-2"
  1038. // 3. if request uri is "/old-path-3?bar=1", users will be redirected to "/new-path-3?foo=1"
  1039. string path_redirect = 2
  1040. [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];
  1041. // Indicates that during redirection, the matched prefix (or path)
  1042. // should be swapped with this value. This option allows redirect URLs be dynamically created
  1043. // based on the request.
  1044. //
  1045. // .. attention::
  1046. //
  1047. // Pay attention to the use of trailing slashes as mentioned in
  1048. // :ref:`RouteAction's prefix_rewrite <envoy_api_field_route.RouteAction.prefix_rewrite>`.
  1049. string prefix_rewrite = 5
  1050. [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];
  1051. }
  1052. // The HTTP status code to use in the redirect response. The default response
  1053. // code is MOVED_PERMANENTLY (301).
  1054. RedirectResponseCode response_code = 3 [(validate.rules).enum = {defined_only: true}];
  1055. // Indicates that during redirection, the query portion of the URL will
  1056. // be removed. Default value is false.
  1057. bool strip_query = 6;
  1058. }
  1059. message DirectResponseAction {
  1060. // Specifies the HTTP response status to be returned.
  1061. uint32 status = 1 [(validate.rules).uint32 = {lt: 600 gte: 100}];
  1062. // Specifies the content of the response body. If this setting is omitted,
  1063. // no body is included in the generated response.
  1064. //
  1065. // .. note::
  1066. //
  1067. // Headers can be specified using *response_headers_to_add* in the enclosing
  1068. // :ref:`envoy_api_msg_route.Route`, :ref:`envoy_api_msg_RouteConfiguration` or
  1069. // :ref:`envoy_api_msg_route.VirtualHost`.
  1070. core.DataSource body = 2;
  1071. }
  1072. message Decorator {
  1073. // The operation name associated with the request matched to this route. If tracing is
  1074. // enabled, this information will be used as the span name reported for this request.
  1075. //
  1076. // .. note::
  1077. //
  1078. // For ingress (inbound) requests, or egress (outbound) responses, this value may be overridden
  1079. // by the :ref:`x-envoy-decorator-operation
  1080. // <config_http_filters_router_x-envoy-decorator-operation>` header.
  1081. string operation = 1 [(validate.rules).string = {min_bytes: 1}];
  1082. // Whether the decorated details should be propagated to the other party. The default is true.
  1083. google.protobuf.BoolValue propagate = 2;
  1084. }
  1085. message Tracing {
  1086. // Target percentage of requests managed by this HTTP connection manager that will be force
  1087. // traced if the :ref:`x-client-trace-id <config_http_conn_man_headers_x-client-trace-id>`
  1088. // header is set. This field is a direct analog for the runtime variable
  1089. // 'tracing.client_sampling' in the :ref:`HTTP Connection Manager
  1090. // <config_http_conn_man_runtime>`.
  1091. // Default: 100%
  1092. type.FractionalPercent client_sampling = 1;
  1093. // Target percentage of requests managed by this HTTP connection manager that will be randomly
  1094. // selected for trace generation, if not requested by the client or not forced. This field is
  1095. // a direct analog for the runtime variable 'tracing.random_sampling' in the
  1096. // :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
  1097. // Default: 100%
  1098. type.FractionalPercent random_sampling = 2;
  1099. // Target percentage of requests managed by this HTTP connection manager that will be traced
  1100. // after all other sampling checks have been applied (client-directed, force tracing, random
  1101. // sampling). This field functions as an upper limit on the total configured sampling rate. For
  1102. // instance, setting client_sampling to 100% but overall_sampling to 1% will result in only 1%
  1103. // of client requests with the appropriate headers to be force traced. This field is a direct
  1104. // analog for the runtime variable 'tracing.global_enabled' in the
  1105. // :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
  1106. // Default: 100%
  1107. type.FractionalPercent overall_sampling = 3;
  1108. // A list of custom tags with unique tag name to create tags for the active span.
  1109. // It will take effect after merging with the :ref:`corresponding configuration
  1110. // <envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.Tracing.custom_tags>`
  1111. // configured in the HTTP connection manager. If two tags with the same name are configured
  1112. // each in the HTTP connection manager and the route level, the one configured here takes
  1113. // priority.
  1114. repeated type.tracing.v2.CustomTag custom_tags = 4;
  1115. }
  1116. // A virtual cluster is a way of specifying a regex matching rule against
  1117. // certain important endpoints such that statistics are generated explicitly for
  1118. // the matched requests. The reason this is useful is that when doing
  1119. // prefix/path matching Envoy does not always know what the application
  1120. // considers to be an endpoint. Thus, it’s impossible for Envoy to generically
  1121. // emit per endpoint statistics. However, often systems have highly critical
  1122. // endpoints that they wish to get “perfect” statistics on. Virtual cluster
  1123. // statistics are perfect in the sense that they are emitted on the downstream
  1124. // side such that they include network level failures.
  1125. //
  1126. // Documentation for :ref:`virtual cluster statistics <config_http_filters_router_vcluster_stats>`.
  1127. //
  1128. // .. note::
  1129. //
  1130. // Virtual clusters are a useful tool, but we do not recommend setting up a virtual cluster for
  1131. // every application endpoint. This is both not easily maintainable and as well the matching and
  1132. // statistics output are not free.
  1133. message VirtualCluster {
  1134. // Specifies a regex pattern to use for matching requests. The entire path of the request
  1135. // must match the regex. The regex grammar used is defined `here
  1136. // <https://en.cppreference.com/w/cpp/regex/ecmascript>`_.
  1137. //
  1138. // Examples:
  1139. //
  1140. // * The regex ``/rides/\d+`` matches the path */rides/0*
  1141. // * The regex ``/rides/\d+`` matches the path */rides/123*
  1142. // * The regex ``/rides/\d+`` does not match the path */rides/123/456*
  1143. //
  1144. // .. attention::
  1145. // This field has been deprecated in favor of `headers` as it is not safe for use with
  1146. // untrusted input in all cases.
  1147. string pattern = 1 [
  1148. deprecated = true,
  1149. (validate.rules).string = {max_bytes: 1024},
  1150. (envoy.annotations.disallowed_by_default) = true
  1151. ];
  1152. // Specifies a list of header matchers to use for matching requests. Each specified header must
  1153. // match. The pseudo-headers `:path` and `:method` can be used to match the request path and
  1154. // method, respectively.
  1155. repeated HeaderMatcher headers = 4;
  1156. // Specifies the name of the virtual cluster. The virtual cluster name as well
  1157. // as the virtual host name are used when emitting statistics. The statistics are emitted by the
  1158. // router filter and are documented :ref:`here <config_http_filters_router_stats>`.
  1159. string name = 2 [(validate.rules).string = {min_bytes: 1}];
  1160. // Optionally specifies the HTTP method to match on. For example GET, PUT,
  1161. // etc.
  1162. //
  1163. // .. attention::
  1164. // This field has been deprecated in favor of `headers`.
  1165. core.RequestMethod method = 3
  1166. [deprecated = true, (envoy.annotations.disallowed_by_default) = true];
  1167. }
  1168. // Global rate limiting :ref:`architecture overview <arch_overview_global_rate_limit>`.
  1169. message RateLimit {
  1170. // [#next-free-field: 7]
  1171. message Action {
  1172. // The following descriptor entry is appended to the descriptor:
  1173. //
  1174. // .. code-block:: cpp
  1175. //
  1176. // ("source_cluster", "<local service cluster>")
  1177. //
  1178. // <local service cluster> is derived from the :option:`--service-cluster` option.
  1179. message SourceCluster {
  1180. }
  1181. // The following descriptor entry is appended to the descriptor:
  1182. //
  1183. // .. code-block:: cpp
  1184. //
  1185. // ("destination_cluster", "<routed target cluster>")
  1186. //
  1187. // Once a request matches against a route table rule, a routed cluster is determined by one of
  1188. // the following :ref:`route table configuration <envoy_api_msg_RouteConfiguration>`
  1189. // settings:
  1190. //
  1191. // * :ref:`cluster <envoy_api_field_route.RouteAction.cluster>` indicates the upstream cluster
  1192. // to route to.
  1193. // * :ref:`weighted_clusters <envoy_api_field_route.RouteAction.weighted_clusters>`
  1194. // chooses a cluster randomly from a set of clusters with attributed weight.
  1195. // * :ref:`cluster_header <envoy_api_field_route.RouteAction.cluster_header>` indicates which
  1196. // header in the request contains the target cluster.
  1197. message DestinationCluster {
  1198. }
  1199. // The following descriptor entry is appended when a header contains a key that matches the
  1200. // *header_name*:
  1201. //
  1202. // .. code-block:: cpp
  1203. //
  1204. // ("<descriptor_key>", "<header_value_queried_from_header>")
  1205. message RequestHeaders {
  1206. // The header name to be queried from the request headers. The header’s
  1207. // value is used to populate the value of the descriptor entry for the
  1208. // descriptor_key.
  1209. string header_name = 1 [
  1210. (validate.rules).string = {min_bytes: 1 well_known_regex: HTTP_HEADER_NAME strict: false}
  1211. ];
  1212. // The key to use in the descriptor entry.
  1213. string descriptor_key = 2 [(validate.rules).string = {min_bytes: 1}];
  1214. }
  1215. // The following descriptor entry is appended to the descriptor and is populated using the
  1216. // trusted address from :ref:`x-forwarded-for <config_http_conn_man_headers_x-forwarded-for>`:
  1217. //
  1218. // .. code-block:: cpp
  1219. //
  1220. // ("remote_address", "<trusted address from x-forwarded-for>")
  1221. message RemoteAddress {
  1222. }
  1223. // The following descriptor entry is appended to the descriptor:
  1224. //
  1225. // .. code-block:: cpp
  1226. //
  1227. // ("generic_key", "<descriptor_value>")
  1228. message GenericKey {
  1229. // The value to use in the descriptor entry.
  1230. string descriptor_value = 1 [(validate.rules).string = {min_bytes: 1}];
  1231. }
  1232. // The following descriptor entry is appended to the descriptor:
  1233. //
  1234. // .. code-block:: cpp
  1235. //
  1236. // ("header_match", "<descriptor_value>")
  1237. message HeaderValueMatch {
  1238. // The value to use in the descriptor entry.
  1239. string descriptor_value = 1 [(validate.rules).string = {min_bytes: 1}];
  1240. // If set to true, the action will append a descriptor entry when the
  1241. // request matches the headers. If set to false, the action will append a
  1242. // descriptor entry when the request does not match the headers. The
  1243. // default value is true.
  1244. google.protobuf.BoolValue expect_match = 2;
  1245. // Specifies a set of headers that the rate limit action should match
  1246. // on. The action will check the request’s headers against all the
  1247. // specified headers in the config. A match will happen if all the
  1248. // headers in the config are present in the request with the same values
  1249. // (or based on presence if the value field is not in the config).
  1250. repeated HeaderMatcher headers = 3 [(validate.rules).repeated = {min_items: 1}];
  1251. }
  1252. oneof action_specifier {
  1253. option (validate.required) = true;
  1254. // Rate limit on source cluster.
  1255. SourceCluster source_cluster = 1;
  1256. // Rate limit on destination cluster.
  1257. DestinationCluster destination_cluster = 2;
  1258. // Rate limit on request headers.
  1259. RequestHeaders request_headers = 3;
  1260. // Rate limit on remote address.
  1261. RemoteAddress remote_address = 4;
  1262. // Rate limit on a generic key.
  1263. GenericKey generic_key = 5;
  1264. // Rate limit on the existence of request headers.
  1265. HeaderValueMatch header_value_match = 6;
  1266. }
  1267. }
  1268. // Refers to the stage set in the filter. The rate limit configuration only
  1269. // applies to filters with the same stage number. The default stage number is
  1270. // 0.
  1271. //
  1272. // .. note::
  1273. //
  1274. // The filter supports a range of 0 - 10 inclusively for stage numbers.
  1275. google.protobuf.UInt32Value stage = 1 [(validate.rules).uint32 = {lte: 10}];
  1276. // The key to be set in runtime to disable this rate limit configuration.
  1277. string disable_key = 2;
  1278. // A list of actions that are to be applied for this rate limit configuration.
  1279. // Order matters as the actions are processed sequentially and the descriptor
  1280. // is composed by appending descriptor entries in that sequence. If an action
  1281. // cannot append a descriptor entry, no descriptor is generated for the
  1282. // configuration. See :ref:`composing actions
  1283. // <config_http_filters_rate_limit_composing_actions>` for additional documentation.
  1284. repeated Action actions = 3 [(validate.rules).repeated = {min_items: 1}];
  1285. }
  1286. // .. attention::
  1287. //
  1288. // Internally, Envoy always uses the HTTP/2 *:authority* header to represent the HTTP/1 *Host*
  1289. // header. Thus, if attempting to match on *Host*, match on *:authority* instead.
  1290. //
  1291. // .. attention::
  1292. //
  1293. // To route on HTTP method, use the special HTTP/2 *:method* header. This works for both
  1294. // HTTP/1 and HTTP/2 as Envoy normalizes headers. E.g.,
  1295. //
  1296. // .. code-block:: json
  1297. //
  1298. // {
  1299. // "name": ":method",
  1300. // "exact_match": "POST"
  1301. // }
  1302. //
  1303. // .. attention::
  1304. // In the absence of any header match specifier, match will default to :ref:`present_match
  1305. // <envoy_api_field_route.HeaderMatcher.present_match>`. i.e, a request that has the :ref:`name
  1306. // <envoy_api_field_route.HeaderMatcher.name>` header will match, regardless of the header's
  1307. // value.
  1308. //
  1309. // [#next-major-version: HeaderMatcher should be refactored to use StringMatcher.]
  1310. // [#next-free-field: 12]
  1311. message HeaderMatcher {
  1312. reserved 2, 3;
  1313. // Specifies the name of the header in the request.
  1314. string name = 1
  1315. [(validate.rules).string = {min_bytes: 1 well_known_regex: HTTP_HEADER_NAME strict: false}];
  1316. // Specifies how the header match will be performed to route the request.
  1317. oneof header_match_specifier {
  1318. // If specified, header match will be performed based on the value of the header.
  1319. string exact_match = 4;
  1320. // If specified, this regex string is a regular expression rule which implies the entire request
  1321. // header value must match the regex. The rule will not match if only a subsequence of the
  1322. // request header value matches the regex. The regex grammar used in the value field is defined
  1323. // `here <https://en.cppreference.com/w/cpp/regex/ecmascript>`_.
  1324. //
  1325. // Examples:
  1326. //
  1327. // * The regex ``\d{3}`` matches the value *123*
  1328. // * The regex ``\d{3}`` does not match the value *1234*
  1329. // * The regex ``\d{3}`` does not match the value *123.456*
  1330. //
  1331. // .. attention::
  1332. // This field has been deprecated in favor of `safe_regex_match` as it is not safe for use
  1333. // with untrusted input in all cases.
  1334. string regex_match = 5 [
  1335. deprecated = true,
  1336. (validate.rules).string = {max_bytes: 1024},
  1337. (envoy.annotations.disallowed_by_default) = true
  1338. ];
  1339. // If specified, this regex string is a regular expression rule which implies the entire request
  1340. // header value must match the regex. The rule will not match if only a subsequence of the
  1341. // request header value matches the regex.
  1342. type.matcher.RegexMatcher safe_regex_match = 11;
  1343. // If specified, header match will be performed based on range.
  1344. // The rule will match if the request header value is within this range.
  1345. // The entire request header value must represent an integer in base 10 notation: consisting of
  1346. // an optional plus or minus sign followed by a sequence of digits. The rule will not match if
  1347. // the header value does not represent an integer. Match will fail for empty values, floating
  1348. // point numbers or if only a subsequence of the header value is an integer.
  1349. //
  1350. // Examples:
  1351. //
  1352. // * For range [-10,0), route will match for header value -1, but not for 0, "somestring", 10.9,
  1353. // "-1somestring"
  1354. type.Int64Range range_match = 6;
  1355. // If specified, header match will be performed based on whether the header is in the
  1356. // request.
  1357. bool present_match = 7;
  1358. // If specified, header match will be performed based on the prefix of the header value.
  1359. // Note: empty prefix is not allowed, please use present_match instead.
  1360. //
  1361. // Examples:
  1362. //
  1363. // * The prefix *abcd* matches the value *abcdxyz*, but not for *abcxyz*.
  1364. string prefix_match = 9 [(validate.rules).string = {min_bytes: 1}];
  1365. // If specified, header match will be performed based on the suffix of the header value.
  1366. // Note: empty suffix is not allowed, please use present_match instead.
  1367. //
  1368. // Examples:
  1369. //
  1370. // * The suffix *abcd* matches the value *xyzabcd*, but not for *xyzbcd*.
  1371. string suffix_match = 10 [(validate.rules).string = {min_bytes: 1}];
  1372. }
  1373. // If specified, the match result will be inverted before checking. Defaults to false.
  1374. //
  1375. // Examples:
  1376. //
  1377. // * The regex ``\d{3}`` does not match the value *1234*, so it will match when inverted.
  1378. // * The range [-10,0) will match the value -1, so it will not match when inverted.
  1379. bool invert_match = 8;
  1380. }
  1381. // Query parameter matching treats the query string of a request's :path header
  1382. // as an ampersand-separated list of keys and/or key=value elements.
  1383. // [#next-free-field: 7]
  1384. message QueryParameterMatcher {
  1385. // Specifies the name of a key that must be present in the requested
  1386. // *path*'s query string.
  1387. string name = 1 [(validate.rules).string = {min_bytes: 1 max_bytes: 1024}];
  1388. // Specifies the value of the key. If the value is absent, a request
  1389. // that contains the key in its query string will match, whether the
  1390. // key appears with a value (e.g., "?debug=true") or not (e.g., "?debug")
  1391. //
  1392. // ..attention::
  1393. // This field is deprecated. Use an `exact` match inside the `string_match` field.
  1394. string value = 3 [deprecated = true, (envoy.annotations.disallowed_by_default) = true];
  1395. // Specifies whether the query parameter value is a regular expression.
  1396. // Defaults to false. The entire query parameter value (i.e., the part to
  1397. // the right of the equals sign in "key=value") must match the regex.
  1398. // E.g., the regex ``\d+$`` will match *123* but not *a123* or *123a*.
  1399. //
  1400. // ..attention::
  1401. // This field is deprecated. Use a `safe_regex` match inside the `string_match` field.
  1402. google.protobuf.BoolValue regex = 4
  1403. [deprecated = true, (envoy.annotations.disallowed_by_default) = true];
  1404. oneof query_parameter_match_specifier {
  1405. // Specifies whether a query parameter value should match against a string.
  1406. type.matcher.StringMatcher string_match = 5 [(validate.rules).message = {required: true}];
  1407. // Specifies whether a query parameter should be present.
  1408. bool present_match = 6;
  1409. }
  1410. }