Kong request transformer - Modify http header

I am trying to change the http host header using request transformer, I do not get an error but the header is not getting changed. Similarly I am trying to replace the http host header with the same scenario. Checked the service and also the kong proxy, nothing getting modified. I wonder how we can check the execution of the Kong plugins.

Modify Header

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: host-header-replace
config:
replace:
headers:
- host: httpbin.org
- security: httpbin.org
plugin: request-transformer

Remove Header

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: remove-host-header-
config:
remove:
headers:
- host: httpbin.org
plugin: request-transformer

You’ll need to set
Kubernetes Ingress Controller annotations - v1.2.x | Kong - Open-Source API Management and Microservice Management on your Service instead.

The Host header is handled unlike most other headers, since it’s set via a template, which overrides any Host header set by a plugin. It takes its value from a variables set based on routing configuration (the Kong routes and services that the controller generates from your Kubernetes configuration).

1 Like

Thank you for the reply, this worked once I stopped the host name propagation.