Header-To-Metadata Filter

This extension may be referenced by the qualified name envoy.filters.http.header_to_metadata

Note

This extension is intended to be robust against untrusted downstream traffic. It assumes that the upstream is trusted.

The configuration for transforming headers into metadata. This is useful for matching load balancer subsets, logging, etc.

Header to Metadata configuration overview.

extensions.filters.http.header_to_metadata.v3.Config

[extensions.filters.http.header_to_metadata.v3.Config proto]

{
  "request_rules": [],
  "response_rules": []
}
request_rules

(repeated extensions.filters.http.header_to_metadata.v3.Config.Rule) The list of rules to apply to requests.

response_rules

(repeated extensions.filters.http.header_to_metadata.v3.Config.Rule) The list of rules to apply to responses.

extensions.filters.http.header_to_metadata.v3.Config.KeyValuePair

[extensions.filters.http.header_to_metadata.v3.Config.KeyValuePair proto]

{
  "metadata_namespace": "...",
  "key": "...",
  "value": "...",
  "regex_value_rewrite": "{...}",
  "type": "...",
  "encode": "..."
}
metadata_namespace

(string) The namespace — if this is empty, the filter’s namespace will be used.

key

(string, REQUIRED) The key to use within the namespace.

value

(string) 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.

regex_value_rewrite

(type.matcher.v3.RegexMatchAndSubstitute) If present, the header’s value will be matched and substituted with this. If there is no match or substitution, the header value is used as-is.

This is only used for on_header_present.

Note: if the value field is non-empty this field should be empty.

type

(extensions.filters.http.header_to_metadata.v3.Config.ValueType) The value’s type — defaults to string.

encode

(extensions.filters.http.header_to_metadata.v3.Config.ValueEncode) How is the value encoded, default is NONE (not encoded). The value will be decoded accordingly before storing to metadata.

extensions.filters.http.header_to_metadata.v3.Config.Rule

[extensions.filters.http.header_to_metadata.v3.Config.Rule proto]

A Rule defines what metadata to apply when a header is present or missing.

{
  "header": "...",
  "cookie": "...",
  "on_header_present": "{...}",
  "on_header_missing": "{...}",
  "remove": "..."
}
header

(string) Specifies that a match will be performed on the value of a header or a cookie.

The header to be extracted.

on_header_present

(extensions.filters.http.header_to_metadata.v3.Config.KeyValuePair) If the header or cookie is present, apply this metadata KeyValuePair.

If the value in the KeyValuePair is non-empty, it’ll be used instead of the header or cookie value.

on_header_missing

(extensions.filters.http.header_to_metadata.v3.Config.KeyValuePair) If the header or cookie 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 or cookie value.

remove

(bool) Whether or not to remove the header after a rule is applied.

This prevents headers from leaking. This field is not supported in case of a cookie.

Enum extensions.filters.http.header_to_metadata.v3.Config.ValueType

[extensions.filters.http.header_to_metadata.v3.Config.ValueType proto]

STRING

(DEFAULT)

NUMBER

PROTOBUF_VALUE

⁣The value is a serialized protobuf.Value.

Enum extensions.filters.http.header_to_metadata.v3.Config.ValueEncode

[extensions.filters.http.header_to_metadata.v3.Config.ValueEncode proto]

ValueEncode defines the encoding algorithm.

NONE

(DEFAULT) ⁣The value is not encoded.

BASE64

⁣The value is encoded in Base64. Note: this is mostly used for STRING and PROTOBUF_VALUE to escape the non-ASCII characters in the header.