Ability to duplicated headers in 'request-transformer' #7245
Replies: 5 comments
-
@jmdacruz @thefosk @thibaultcha how about instead of adding a new config like config.replace.headers={"h1:${refer another header}", "h1:v2", "h2:v1"} |
Beta Was this translation helpful? Give feedback.
-
Looks good to me, and it might be an even easier fix too. It might also me more powerful in the sense that you can rewrite headers, etc. I'm wondering if such "expression language" would be worth considering, e.g., using regular expressions for replacements (a la Bash replacements on environment variables) |
Beta Was this translation helpful? Give feedback.
-
This would make migrating to Kong a little smoother |
Beta Was this translation helpful? Give feedback.
-
Guys, do we have any workaround for this? |
Beta Was this translation helpful? Give feedback.
-
We can use config.rename.headers to achieve this. --data "config.rename.headers=header1:header2" I started looking into code how it's writing to understand if It's possible to pass the header1 variable for header2. I noticed there is some code for rename header "-- Rename headers(s)" which is not there in the documentation. It is doing kind of both things what I was looking. First, replace the new value from Header1 to Header2 and then scrapping the header1. (In other words Rename :p) Best Regards, |
Beta Was this translation helpful? Give feedback.
-
We usually run into situations in which we have applications that expect certain values (e.g., consumer identity) in a special header. While we have authentication plugins that use both Kong's standard headers (e.g., consumer-custom-id) and our own headers, when using some other authentication plugins such as basic-auth we can't override this. In these scenarios, it would be desirable to be able to duplicate a header with a different header name.
This would be something like this:
config.duplicate.headers=x-consumer-custom-id|x-foo-bar-duplicate-custom-id, h1|h2, ...
, where the|
acts as a delimiting character (there might be a better one... something that is typically not present in headers?)Beta Was this translation helpful? Give feedback.
All reactions