[Feat] Configurable Common Kong headers #7311
Replies: 4 comments 1 reply
-
I know that the performance wouldn't be the same as just hard-coding these header names, but it seems to me that you could use the Response Transformer's |
Beta Was this translation helpful? Give feedback.
-
Haven’t tested it yet but I imagine a global instance of the plugin renaming those headers would work. I personally still prefer native configurability but agree neat idea I hadn’t thought about fixing it that way, I just drop in an altered constants.lua file every time. |
Beta Was this translation helpful? Give feedback.
-
Configuring response transformer to rename kong headers does not work. Here's the example I used to test it. apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name: golbresponse
annotations:
kubernetes.io/ingress.class: kong
labels:
global: \"true\"
config:
rename:
headers:
x-kong-proxy-latency: gateway-latency
plugin: response-transformer-advanced |
Beta Was this translation helpful? Give feedback.
-
Summary
For a long time we have always dropped in a custom
constants.lua
file overriding these 5 below header fields:https://github.com/Kong/kong/blob/master/kong/constants.lua#L71
For example maybe I as a user just want them labeled plain as:
1.
Or maybe I want to "name" my gateway something other than
Kong
to give my gateway a personal touch:2.
Would be neat to expose some of these common values to be configurable and more flexible if desired(but to default to what they are now).
Ways of exposure could be through Kong conf or environment variable overrides for example. This way I can remove 1 extra customization we do during Kong builds and version changes. Another way to implement this would be some kinda "branding" field in the conf set to Kong, and setting that field to empty string or missing from conf would achieve example 1 above and setting it to a different string would achieve example 2.
Looking to hopefully review a lot of our Kong setup and finding ways to remove burdens of dropping in modified direct lua files we have been running with for a long time as it becomes a bit messy for us over time.
Another area of research will be looking into whats in our custom Kong template and now that can be pushed into the standard process so we don't have to maintain a custom template forever(will likely have to wait until upstream tls pools pending prs is merged before that can be considered).
Beta Was this translation helpful? Give feedback.
All reactions