I have a working installation of Kong on a Kubernetes cluster, using kubernetes-ingress-controller functionality (https://github.com/Kong/kubernetes-ingress-controller).
I would like to remove the following Kong's related headers:
- "X-Kong-Upstream-Latency"
- "X-Kong-Proxy-Latency"
- "Via"
- "Server"
I tried by using the response-transformer plugin by applying the following KongPlugin resource:
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: kong-response-transformer
config:
remove:
headers:
- "X-Kong-Upstream-Latency"
- "X-Kong-Proxy-Latency"
- "Via"
- "Server"
plugin: response-transformer
But only the "Server" header is removed from responses. Is there a way to remove such headers from response in a "kubernetes-ingress-controller" way by using some custom resources?
I found several GitHub issues related to this problem (1, 2) but all of them refers to the possibility to update the Kong configuration file (/etc/kong/kong.yml) and I honestly don't know how to apply such changes in my Kubernetes environment. Passing the following lines into a ConfigMap does not fix the problem:
# Add additional response headers
header_filter_by_lua_block {
kong.header_filter()
ngx.header["Server"] = nil
ngx.header["Via"] = nil
ngx.header["X-Kong-Proxy-Latency"] = nil
ngx.header["X-Kong-Upstream-Latency"] = nil
}
Any help on this? Thank you...
Edit: Kong version is 2.0.3, kong-ingress-controller version is 0.8.1.