Header-To-Metadata Filter

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

Note

This extension is functional but has not had substantial production burn time, use only with this caveat.

This extension is not hardened and should only be used in deployments where both the downstream and upstream are trusted.

Tip

This extension extends and can be used with the following extension category:

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

Header to Metadata configuration overview.

extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata

[extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata proto]

{
  "request_rules": []
}
request_rules

(repeated extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.Rule, REQUIRED) The list of rules to apply to requests.

extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.KeyValuePair

[extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.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 on_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 on_missing case, a non-empty value must be provided otherwise no metadata is added.

Only one of value, regex_value_rewrite may be set.

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_present.

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

Only one of value, regex_value_rewrite may be set.

type

(extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.ValueType) The value’s type — defaults to string.

encode

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

extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.Rule

[extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.Rule proto]

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

{
  "header": "...",
  "on_present": "{...}",
  "on_missing": "{...}",
  "remove": "..."
}
header

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

The header to be extracted.

on_present

(extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.KeyValuePair) 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.

on_missing

(extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.KeyValuePair) 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.

remove

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

This prevents headers from leaking.

Enum extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.ValueType

[extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.ValueType proto]

STRING

(DEFAULT)

NUMBER

PROTOBUF_VALUE

⁣The value is a serialized protobuf.Value.

Enum extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.ValueEncode

[extensions.filters.network.thrift_proxy.filters.header_to_metadata.v3.HeaderToMetadata.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.