tomMoulard / htransformation

A Traefik plugin to change on the fly header's value of a request
MIT License
81 stars 13 forks source link

Value from other headers #14

Closed ska-ibees closed 2 years ago

ska-ibees commented 3 years ago

Hello Team,

Is it possible to rewrite value of existing header based on value from other headers?

Like in below example, there are multiple IPs in the 'X-Forwarded-For' header and I need to set value of X-Real-IP to my-ip.

X-Forwarded-For: my-ip, 192.168.13.91 X-Forwarded-Host: whoami.example.com X-Forwarded-Port: 80 X-Forwarded-Proto: http X-Forwarded-Server: traefik-ingress-7cf7c75f5d-nkbgs X-Real-Ip: 192.168.13.91

tomMoulard commented 3 years ago

Hello @ska-ibees,

It is not currently possible as cookie values are set somewhat statically in the plugin settings (doc).

As it could be done in a PR, I will label it as a Feature Request.

Shotster commented 3 years ago

A related capability - the ability to transform header values via regex, as requested here for ValueRewriteRule - would be extremely useful as well.

In my particular case, I wouldn’t need the ability to reference the value of other headers - just the ability to transform the value of specific headers. I’d be happy to submit a separate issue if it’s warranted.

tomMoulard commented 3 years ago

Hello @Shotster,

Thanks for your interest in this plugin !

Feel free to open a new issue regarding this message.

tomMoulard commented 2 years ago

Close thanks to 865d14bdd255373308382fd932cd0be1c84acba0