Specifies transformations based on the route matches. The first matched transformation will be applied. If there are overlapped match conditions, please put the most specific match first.
stage
int
Only RouteTransformations.RouteTransformation with matching stage will be used with this filter.
The route matching parameter. Only when the match is satisfied, the “requires” field will apply. For example: following match will match all requests. .. code-block:: yaml match: prefix: /.
Specifies a set of headers that the route should match on. The router will check the response headers against all the specified headers in the route config. A match will happen if all the headers in the route are present in the request with the same values (or based on presence if the value field is not in the config).
This type of transformation will make all the headers available in the response body. The resulting JSON body will consist of two attributes: ‘headers’, containing the headers, and ‘body’, containing the original body. Only one of headerBodyTransform, transformationTemplate, or transformerConfig can be set.
Configuration for an externally implemented transformer, used by envoy transformation filter. Only one of transformerConfig, transformationTemplate, or headerBodyTransform can be set.
Extraction
Extractions can be used to extract information from the request/response.
The extracted information can then be referenced in template fields.
"header": string"body": .google.protobuf.Empty"regex": string"subgroup": int
Field
Type
Description
header
string
Extract information from headers. Only one of header or body can be set.
Extract information from the request/response body. Only one of body or header can be set.
regex
string
Only strings matching this regular expression will be part of the extraction. This regex must match the entire source in order for a value to be extracted. The most simple value for this field is ‘.*’, which matches the whole source. The field is required. If extraction fails the result is an empty value.
subgroup
int
If your regex contains capturing groups, use this field to determine which group should be selected.
If set to true, use JSON pointer notation (e.g. “time/start”) instead of dot notation (e.g. “time.start”) to access JSON elements. Defaults to false. Please note that, if set to ‘true’, you will need to use the extraction function to access extractors in the template (e.g. ‘{{ extraction(“my_extractor”) }}'); if the default value of ‘false’ is used, extractors will simply be available by their name (e.g. ‘{{ my_extractor }}').
extractors
map<string, .envoy.api.v2.filter.http.Extraction>
Use this attribute to extract information from the request. It consists of a map of strings to extractors. The extractor will defines which information will be extracted, while the string key will provide the extractor with a name. You can reference extractors by their name in templates, e.g. “{{ my-extractor }}” will render to the value of the “my-extractor” extractor.
Use this attribute to transform request/response headers. It consists of a map of strings to templates. The string key determines the name of the resulting header, the rendered template will determine the value. Any existing headers with the same header name will be replaced by the transformed header. If a header name is included in headers and headers_to_append, it will first be replaced the template in headers, then additional header values will be appended by the templates defined in headers_to_append. For example, the following header transformation configuration: yaml headers: x-header-one: {"text": "first {{inja}} template"} x-header-one: {"text": "second {{inja}} template"} headersToAppend: - key: x-header-one value: {"text": "first appended {{inja}} template"} - key: x-header-one value: {"text": "second appended {{inja}} template"} will result in the following headers on the HTTP message: x-header-one: first inja template x-header-one: first appended inja template x-header-one: second appended inja template.
Use this attribute to transform request/response headers. It consists of an array of string/template objects. Use this attribute to define multiple templates for a single header. Header template(s) defined here will be appended to any existing headers with the same header name, not replace existing ones. See headers documentation to see an example of usage.
headersToRemove
[]string
Attribute to remove headers from requests. If a header is present multiple times, all instances of the header will be removed.
This will cause the transformation filter not to buffer the body. Use this setting if the response body is large and you don’t need to transform nor extract information from it. Only one of passthrough, body, or mergeExtractorsToBody can be set.
Merge all defined extractors to the request/response body. If you want to nest elements inside the body, use dot separator in the extractor name. Only one of mergeExtractorsToBody, body, or passthrough can be set.
Will attempt to parse the request/response body as JSON
DontParse
The request/response body will be treated as plain text
InjaTemplate
Defines an Inja template that will be
rendered by Gloo. In addition to the core template functions, the Gloo
transformation filter defines the following custom functions:
header(header_name): returns the value of the header with the given name.
extraction(extractor_name): returns the value of the extractor with the
given name.
env(env_var_name): returns the value of the environment variable with the
given name.
body(): returns the request/response body.
context(): returns the base JSON context (allowing for example to range on
a JSON body that is an array).
request_header(header_name): returns the value of the request header with
the given name. Use this option when you want to include request header values in response
transformations.
base64_encode(string): encodes the input string to base64.
base64_decode(string): decodes the input string from base64.
substring(string, start_pos, substring_len): returns a substring of the
input string, starting at start_pos and extending for substring_len
characters. If no substring_len is provided or substring_len is <= 0, the
substring extends to the end of the input string.
"text": string
Field
Type
Description
text
string
Passthrough
Field
Type
Description
MergeExtractorsToBody
Field
Type
Description
HeaderBodyTransform
"addRequestMetadata": bool
Field
Type
Description
addRequestMetadata
bool
When transforming a request, setting this to true will additionally add “queryString”, “queryStringParameters”, “multiValueQueryStringParameters”, “httpMethod”, “path”, and “multiValueHeaders” to the body.