Change Default Response Headers

My company wants to “rebrand” kong. So that means:

Changing the name of some headers, like X-Kong-Upstream-Latency"
Change the value of the “Via” header

I saw the header names in the constants.lua file, though I’d prefer to override those values instead of changing the code. I did not see anything about how to change the Via header value.

Welcome to Kong Nation!

You can disable those headers if you would like using headers configuration option in Kong’s configuration file. If you would like to record the latencies, you can do so using one of the metrics plugins as well.

Here is what you can do if you would like to change them:

  • Edit the source code and change the names, which in your case, you would prefer not to do.
  • use the headers property in kong.conf to ensure that Kong doesn’t inject them. Then, write a 5 line custom plugin to inject the headers with same values in the header_filter phase. The PDK makes it super easy to implement this. Please make sure to set the priority of the plugin such that it executes at the end.

Thank you very much for the tip! You gave me the approximate answer I was expecting, though I’m happy to admit that I don’t know anywhere near everything in relation to Kong. :slight_smile: