Add support for extracting dynamic metadata from requests. This can then be used as static metadata would be used (e.g.: for subset load balancer metadata matches, logging, etc). Risk Level: Low Testing: unit-test Docs Changes: Basic docs. Release Notes: N/A Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com> Mirrored from https://github.com/envoyproxy/envoy @ 827c0a548ab38d55debe00587ee27253786befadpull/620/head
parent
d3172dcf03
commit
4b04ff7611
6 changed files with 82 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||||||
|
load("//bazel:api_build_system.bzl", "api_proto_library") |
||||||
|
|
||||||
|
licenses(["notice"]) # Apache 2 |
||||||
|
|
||||||
|
api_proto_library( |
||||||
|
name = "header_to_metadata", |
||||||
|
srcs = ["header_to_metadata.proto"], |
||||||
|
deps = [], |
||||||
|
) |
@ -0,0 +1,69 @@ |
|||||||
|
syntax = "proto3"; |
||||||
|
|
||||||
|
package envoy.config.filter.http.header_to_metadata.v2; |
||||||
|
option go_package = "v2"; |
||||||
|
|
||||||
|
import "validate/validate.proto"; |
||||||
|
|
||||||
|
// [#protodoc-title: Header-To-Metadata Filter] |
||||||
|
// |
||||||
|
// The configuration for transforming headers into metadata. This is useful |
||||||
|
// for matching load balancer subsets, logging, etc. |
||||||
|
// |
||||||
|
// Header to Metadata :ref:`configuration overview <config_http_filters_header_to_metadata>`. |
||||||
|
|
||||||
|
message Config { |
||||||
|
enum ValueType { |
||||||
|
STRING = 0; |
||||||
|
NUMBER = 1; |
||||||
|
} |
||||||
|
|
||||||
|
message KeyValuePair { |
||||||
|
// The namespace — if this is empty, the filter's namespace will be used. |
||||||
|
string metadata_namespace = 1; |
||||||
|
|
||||||
|
// The key to use within the namespace. |
||||||
|
string key = 2 [(validate.rules).string.min_bytes = 1]; |
||||||
|
|
||||||
|
// The value to pair with the given key. |
||||||
|
// |
||||||
|
// When used for a `on_header_present` case, if value is non-empty it'll be used |
||||||
|
// instead of the header value. If both are empty, no metadata is added. |
||||||
|
// |
||||||
|
// When used for a `on_header_missing` case, a non-empty value must be provided |
||||||
|
// otherwise no metadata is added. |
||||||
|
string value = 3; |
||||||
|
|
||||||
|
// The value's type — defaults to string. |
||||||
|
ValueType type = 4; |
||||||
|
} |
||||||
|
|
||||||
|
// A Rule defines what metadata to apply when a header is present or missing. |
||||||
|
message Rule { |
||||||
|
// The header that triggers this rule — required. |
||||||
|
string header = 1 [(validate.rules).string.min_bytes = 1]; |
||||||
|
|
||||||
|
// If the header is present, apply this metadata KeyValuePair. |
||||||
|
// |
||||||
|
// If the value in the KeyValuePair is non-empty, it'll be used instead |
||||||
|
// of the header value. |
||||||
|
KeyValuePair on_header_present = 2; |
||||||
|
|
||||||
|
// If the header is not present, apply this metadata KeyValuePair. |
||||||
|
// |
||||||
|
// The value in the KeyValuePair must be set, since it'll be used in lieu |
||||||
|
// of the missing header value. |
||||||
|
KeyValuePair on_header_missing = 3; |
||||||
|
|
||||||
|
// Whether or not to remove the header after a rule is applied. |
||||||
|
// |
||||||
|
// This prevents headers from leaking. |
||||||
|
bool remove = 4; |
||||||
|
} |
||||||
|
|
||||||
|
// The list of rules to apply to requests. |
||||||
|
repeated Rule request_rules = 1; |
||||||
|
|
||||||
|
// The list of rules to apply to responses. |
||||||
|
repeated Rule response_rules = 2; |
||||||
|
} |
Loading…
Reference in new issue