route_components.proto 101 KB

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