I’m specifically working in a k8s environment using the kong ingresscontroller (and I haven’t used kong elsewhere), so forgive me if this is irrelevant to other kong applications.
There are currently two ways in kong to edit the host header as a request passes through the ingress controller: a ‘host-header’ annotation on the service, or a ‘preserve-host’ annotation on the ingress. According to the docs, ‘preserve-host’ takes precedence over ‘host-header’: Kong Google Cloud Logging plugin | Kong
And that’s totally fine… EXCEPT:
In version 0.4.0 of kong, ya’ll set ‘preserve_hosts’ to a default of ‘true’. It looks like that’s still the case…
…which means, out of the box, ‘host-header’ does nothing. New users expecting ‘host-header’ to work also need to use the ‘preserve-host’ annotation on their ingress or find some way to overwrite the ‘preserve_hosts’ default inside the ingress controller. I know finding this information led me on a bit of a goose chase!
It might be wise to allow ‘host-header’ to overwrite ‘preserve-host’ as opposed to vice-versa. After all, if you’re explicitly specifying a host-header, you’re definitely trying to overwrite whatever OTHER value is in the host header!