|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package envoy.extensions.filters.http.custom_response.v3; |
| 4 | + |
| 5 | +import "xds/annotations/v3/status.proto"; |
| 6 | +import "xds/type/matcher/v3/matcher.proto"; |
| 7 | + |
| 8 | +import "udpa/annotations/status.proto"; |
| 9 | + |
| 10 | +option java_package = "io.envoyproxy.envoy.extensions.filters.http.custom_response.v3"; |
| 11 | +option java_outer_classname = "CustomResponseProto"; |
| 12 | +option java_multiple_files = true; |
| 13 | +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/custom_response/v3;custom_responsev3"; |
| 14 | +option (udpa.annotations.file_status).package_version_status = ACTIVE; |
| 15 | +option (xds.annotations.v3.file_status).work_in_progress = true; |
| 16 | + |
| 17 | +// [#protodoc-title: Custom Response Filter] |
| 18 | +// [#extension: envoy.filters.http.custom_response] |
| 19 | + |
| 20 | +// The Custom Response Filter allows for replacing upstream responses. |
| 21 | + |
| 22 | +// The filter configuration is a collection of custom response |
| 23 | +// policies in a matcher tree. The configuration can be defined at the filter, |
| 24 | +// virtual host or route level. The response will be matched against the most |
| 25 | +// specific to the least specific config, till a match is found. |
| 26 | +message CustomResponse { |
| 27 | + // Matcher to match against the original response to select a |
| 28 | + // :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` |
| 29 | + // that will override the original response. The matching is done by matching |
| 30 | + // against :ref:`response header values<extension_category_envoy.matching.http.input>` |
| 31 | + // Example: |
| 32 | + // |
| 33 | + // .. validated-code-block:: yaml |
| 34 | + // :type-name: xds.type.matcher.v3.Matcher |
| 35 | + // |
| 36 | + // matcher_list: |
| 37 | + // matchers: |
| 38 | + // # Apply a locally stored custom response to any 4xx response. |
| 39 | + // - predicate: |
| 40 | + // single_predicate: |
| 41 | + // input: |
| 42 | + // name: 4xx_response |
| 43 | + // typed_config: |
| 44 | + // "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput |
| 45 | + // value_match: |
| 46 | + // exact: "4xx" |
| 47 | + // on_match: |
| 48 | + // action: |
| 49 | + // name: action |
| 50 | + // typed_config: |
| 51 | + // "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy |
| 52 | + // status_code: 499 |
| 53 | + // body: |
| 54 | + // inline_string: "not allowed" |
| 55 | + // body_format: |
| 56 | + // json_format: |
| 57 | + // status: "%RESPONSE_CODE%" |
| 58 | + // message: "%LOCAL_REPLY_BODY%" |
| 59 | + // response_headers_to_add: |
| 60 | + // - header: |
| 61 | + // key: "foo" |
| 62 | + // value: "x-bar" |
| 63 | + // # Redirect to different upstream if the status code is one of 502, 503 or 504. |
| 64 | + // - predicate: |
| 65 | + // or_matcher: |
| 66 | + // predicate: |
| 67 | + // - single_predicate: |
| 68 | + // input: |
| 69 | + // name: "502_response" |
| 70 | + // typed_config: |
| 71 | + // "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput |
| 72 | + // value_match: |
| 73 | + // exact: "502" |
| 74 | + // - single_predicate: |
| 75 | + // input: |
| 76 | + // name: "503_response" |
| 77 | + // typed_config: |
| 78 | + // "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput |
| 79 | + // value_match: |
| 80 | + // exact: "503" |
| 81 | + // - single_predicate: |
| 82 | + // input: |
| 83 | + // name: "504_response" |
| 84 | + // typed_config: |
| 85 | + // "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput |
| 86 | + // value_match: |
| 87 | + // exact: "504" |
| 88 | + // on_match: |
| 89 | + // action: |
| 90 | + // name: action |
| 91 | + // typed_config: |
| 92 | + // "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy |
| 93 | + // status_code: 299 |
| 94 | + // uri: "https://foo.example/gateway_error" |
| 95 | + // response_headers_to_add: |
| 96 | + // - header: |
| 97 | + // key: "foo2" |
| 98 | + // value: "x-bar2" |
| 99 | + // |
| 100 | + // -- attention:: |
| 101 | + // The first matched policy wins. Once the response is matched, matcher |
| 102 | + // evaluations end. |
| 103 | + // |
| 104 | + // Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>` |
| 105 | + // documentation for more information on the matcher trees. |
| 106 | + // [#extension-category: envoy.http.custom_response] |
| 107 | + xds.type.matcher.v3.Matcher custom_response_matcher = 1; |
| 108 | +} |
0 commit comments