Transform filter configuration (proto)

This extension has the qualified name envoy.filters.http.transform

Note

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

This extension has an unknown security posture 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:

This extension must be configured with one of the following type URLs:

Transform filter configuration overview to perform HTTP header and body transformations.

extensions.filters.http.transform.v3.TransformConfig

[extensions.filters.http.transform.v3.TransformConfig proto]

Configuration for the transform filter. The filter may buffer the request/response until the entire body is received, and then mutate the headers and body according to the contents of the request/response. The request and response transformations are independent and could be configured separately. Only JSON body transformation is supported for now.

{
  "request_transformation": {...},
  "response_transformation": {...},
  "clear_cluster_cache": ...,
  "clear_route_cache": ...
}
request_transformation

(extensions.filters.http.transform.v3.Transformation) Configuration for transforming request.

Note

If set then the entire request headers and body will always be buffered on a JSON request even if only headers are transformed.

response_transformation

(extensions.filters.http.transform.v3.Transformation) Configuration for transforming response.

Note

If set then the entire response headers and body will always be buffered on a JSON response even if only headers are transformed.

clear_cluster_cache

(bool) If true and the request headers are transformed, Envoy will re-evaluate the target cluster in the same route. Please ensure the cluster specifier in the route supports dynamic evaluation or this flag will have no effect, e.g. matcher cluster specifier.

Only one of clear_cluster_cache and clear_route_cache can be true.

clear_route_cache

(bool) If true and the request headers are transformed, Envoy will clear the route cache for the current request and force re-evaluation of the route. This has performance penalty and should only be used when the route match criteria depends on the transformed headers.

Only one of clear_cluster_cache and clear_route_cache can be true.

extensions.filters.http.transform.v3.Transformation

[extensions.filters.http.transform.v3.Transformation proto]

{
  "headers_mutations": [],
  "body_transformation": {...}
}
headers_mutations

(repeated config.common.mutation_rules.v3.HeaderMutation) The header mutations to perform. The substitution format specifier could be applied here. In addition to the commonly used format specifiers, this filter introduces additional format specifiers:

  • %REQUEST_BODY(KEY*)%: the request body. And Key KEY is an optional lookup key in the namespace with the option of specifying nested keys separated by ‘:’.

  • %RESPONSE_BODY(KEY*)%: the response body. And Key KEY is an optional lookup key in the namespace with the option of specifying nested keys separated by ‘:’.

body_transformation

(extensions.filters.http.transform.v3.BodyTransformation) The body transformation configuration. If not set, no body transformation will be performed.

extensions.filters.http.transform.v3.BodyTransformation

[extensions.filters.http.transform.v3.BodyTransformation proto]

{
  "body_format": {...},
  "action": ...
}
body_format

(config.core.v3.SubstitutionFormatString, REQUIRED) Body transformation configuration. The substitution format string is used as the template to generate the transformed new body content. The substitution format specifier could be applied here. And except the commonly used format specifiers, the additional format specifiers %REQUEST_BODY(KEY*)% and %RESPONSE_BODY(KEY*)% could also be used here.

action

(extensions.filters.http.transform.v3.BodyTransformation.TransformAction) The action to perform for new body content and original body content. For example, if MERGE is used, then the new body content generated from the body_format will be merged into the original body content.

Default is MERGE.

Enum extensions.filters.http.transform.v3.BodyTransformation.TransformAction

[extensions.filters.http.transform.v3.BodyTransformation.TransformAction proto]

MERGE

(DEFAULT) ⁣Merge the transformed body with the original body. This is the default action.

REPLACE

⁣Replace the original body with the transformed body.