I need help in the configuration of the response transformer plugin for adding/appending dynamic headers to the response. I am able to add static headers to the response header, but even after adding the dynamic header, I get the static value.
However, the same configuration works with the request transformer plugin and the documentation of the response transformer plugin does not cover it.
The configuration of both the request and response transformer plugins is given below and I have enabled both of them on my ingress.
apiVersion: configuration.konghq/v1
config:
add:
headers:
- x-test-header:$(headers.Authorization)
kind: KongPlugin
metadata:
name: request-transformer
namespace: kong-test
plugin: request-transformer
and this one below too:
apiVersion: configuration.konghq/v1
config:
append:
headers:
- x-test-response-header:$(headers.x-test-header)
kind: KongPlugin
metadata:
name: response-transformer
namespace: kong-test
plugin: response-transformer
I have also tried response header with the value x-test-response-header:$(headers.Authorization)
and also add instead of append but i still get the same static value $(headers.Authorization)
in response header.
The headers are available in the body which i have tested using httpbin service.
{
"headers": {
"Accept": “/”,
"Accept-Encoding": “gzip, deflate, br”,
"Apikey": "123456",
"Authorization": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJlWkJzZTBYZURneTBwamxKaFczZVJtd29IdmxDN0lYaEFmMWFIRFVwWURnIn0…"
}
}
Please let me know the right way to configure it.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742378964a4432756.html
评论列表(0条)