Thankyou Willy. http-send-name-header works for my use case.

@Norman - Yes, we are looking at replacing the usage of X- headers.

Thanks
Sachin

On Mon, Dec 17, 2018 at 2:18 AM Norman Branitsky <
[email protected]> wrote:

> Don't forget the "X-" header prefix is deprecated:
> https://tools.ietf.org/html/rfc6648
>
> Norman Branitsky
>
> On Dec 16, 2018, at 03:50, Willy Tarreau <[email protected]> wrote:
>
> Hi Sachin,
>
> On Sat, Dec 15, 2018 at 10:32:21PM +0530, Sachin Shetty wrote:
>
> Hi,
>
>
> We have a tricky requirement to set a different header value in the request
>
> based on which server in a backend is picked.
>
>
> backend pod0
>
>    ...
>
>    server server1 server1:6180  check
>
>    server server2 server2:6180  check
>
>    server server3 server3:6180  check
>
>
> so when request is forwarded to server1 - I want to inject an header
>
> "X-Some-Header: Server1",  "X-Some-Header: Server2"  for server 2 and so
>
> on.
>
>
> You have this with "http-send-name-header", you need to pass it the
> header field name and it will fill the value with the server's name.
> It will even support redispatch by rewinding the stream and rewriting
> the value (which made it very tricky and infamous for quite some time).
>
> If it possible to register some lua action that would inject the header
>
> based on the server selected  before the request is forwarded to the
> server.
>
>
> In fact except for the directive above it's not possible to perform
> changes after the server has been selected, because the server is
> selected when trying to connect, which happens after the contents are
> being forwarded, thus you can't perform any processing anymore. There
> is quite some ugly code to support http-send-name-header and it cannot
> be generalized at all. Just to give you an idea, think that a hash-based
> LB algo (balance uri, balance hdr) could decide to use some contents
> you're about to modify... So the contents have to be fixed before the
> server is chosen.
>
> Cheers,
> Willy
>
>

Reply via email to