Header-To-Metadata Filter

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

Header to Metadata configuration overview.

config.filter.http.header_to_metadata.v2.Config

[config.filter.http.header_to_metadata.v2.Config proto]

{
  "request_rules": [],
  "response_rules": []
}
request_rules
(config.filter.http.header_to_metadata.v2.Config.Rule) The list of rules to apply to requests.
response_rules
(config.filter.http.header_to_metadata.v2.Config.Rule) The list of rules to apply to responses.

config.filter.http.header_to_metadata.v2.Config.KeyValuePair

[config.filter.http.header_to_metadata.v2.Config.KeyValuePair proto]

{
  "metadata_namespace": "...",
  "key": "...",
  "value": "...",
  "type": "..."
}
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.

type
(config.filter.http.header_to_metadata.v2.Config.ValueType) The value’s type — defaults to string.

config.filter.http.header_to_metadata.v2.Config.Rule

[config.filter.http.header_to_metadata.v2.Config.Rule proto]

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

{
  "header": "...",
  "on_header_present": "{...}",
  "on_header_missing": "{...}",
  "remove": "..."
}
header
(string, REQUIRED) The header that triggers this rule — required.
on_header_present

(config.filter.http.header_to_metadata.v2.Config.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_header_missing

(config.filter.http.header_to_metadata.v2.Config.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 config.filter.http.header_to_metadata.v2.Config.ValueType

[config.filter.http.header_to_metadata.v2.Config.ValueType proto]

STRING
(DEFAULT)
NUMBER