Transformer plugin
The Transformer plugin changes request headers, query parameters, cookies, and JSON body fields before the gateway forwards the request. It can also change response headers, status, cookies, and JSON body fields. Rules run in the order you list them. Transformer is a Preview plugin.
On an Enterprise data plane, Transformer needs the OPA policy sidecar, which the Helm chart turns on with opa.enabled. It’s off by default, and Transformer has no in-process fallback. Without the sidecar, the plugin fails according to its on_error setting, which defaults to fail_closed, so the request fails. The data plane must allow Preview plugins. For more information, see Helm values.
Where it runs
Only the instance at the narrowest scope runs.
Configuration
The changes to make, in order. A rule whose target starts with response. runs on the response.
The operation. See the list after this table.
What to change: request.method, request.path, request.header.<name>, request.query.<name>, request.body.<path>, request.cookie.<name>, response.header.<name>, response.status, response.body.<path>, or response.cookie.<name>. headers and cookies work as plural forms, for example request.headers.<name>. request.method takes only set, template, copy, move, and rename. request.path takes only set and template, and each value substituted into a path template is escaped as one path segment.
The value for set, add, default, and template. A value written to a body field is stored as JSON when it parses as JSON, otherwise as a string.
The source for copy, move, rename, and hash, for example identity.consumer, request.header.<name>, or request.body.<path>.
For response cookie targets only: path, domain, max_age, secure, http_only, and same_site (lax, strict, or none).
The operations do the following:
setreplaces the target withvalue.addaddsvaluebeside existing header or query values.defaultsetsvalueonly if the target is absent.removedeletes the target.addandremovearen’t valid onresponse.status, anddefaulton a response cookie always sets the value.copysets the target to the value offrom.moveandrenamecopy, then delete the source when it’s a header, query parameter, body field, or request cookie.templatesets the target tovaluewith every{{ reference }}replaced, for example{{ identity.consumer }}.hashsets the target to the lowercase hexadecimal SHA-256 offrom, or of the target itself whenfromis omitted.
The Authorization header, and headers that the gateway fills with credentials, can’t be read as sources.

