Response transformer plugin configuration for Kong Kubernetes Ingress Controller - Stack Overflow

I need help in the configuration of the response transformer plugin for addingappending dynamic header

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信