Re: Adding backend server name as request header
On Thu, May 12, 2016 at 11:09:09PM +0200, Dennis Jacobfeuerborn wrote: > Hi, > remember that this directive adds a request header and not a response > header i.e. you will not see this header in the response in the browser > but only in the request on the backend server that will serve the > request. There you can copy that information into a response header if > you want. If you want it in the response, it's much easier : http-response add-header x-foo-server-name %s Willy
Re: Adding backend server name as request header
Hi, remember that this directive adds a request header and not a response header i.e. you will not see this header in the response in the browser but only in the request on the backend server that will serve the request. There you can copy that information into a response header if you want. Regards, Dennis On 12.05.2016 21:15, Guillaume Bourque wrote: > Hello > > I looked into the doc to saw that we can put the directive in the backend > this is what I added to my config > > http-send-name-header X-CustomHeader > > But from my user browser I never get this header is there something that I > need to enable on the global section in order for this to be working ? > > HA-Proxy version 1.5.4 2014/09/02 > Copyright 2000-2014 Willy Tarreau > > Build options : > TARGET = linux2628 > CPU = generic > CC = gcc > CFLAGS = -O2 -g -fno-strict-aliasing > OPTIONS = USE_LINUX_TPROXY=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 > USE_PCRE=1 > > TIA > > Guillaume > > --- > Le 2016-05-12 à 14:29, Dennis Jacobfeuerborn a écrit : > >> This is exactly what I'm looking for, thanks! >> I was looking at the variables in Section 7.3 as I didn't think there >> would be a dedicated directive for this. Apparently I was wrong :) >> >> Regards, >> Dennis >> >> On 12.05.2016 18:48, Mehdi Ahmadi wrote: >>> It may be that your after: >>> ``` >>> http-send-name-header X-CustomHeader >>> ``` >>> Which would set the ID of the selected server into the header >>> `X-CustomHeader`. >>> See the documentation for further details. >>> http://cbonte.github.io/haproxy-dconv/configuration-1.5.html >>> >>> >>> >>> On Thu, May 12, 2016 at 6:29 PM, Dennis Jacobfeuerborn < >>> denni...@conversis.de> wrote: >>> Hi, I'm wondering if there is a way to add the name of the server chosen for the request as a request header i.e. if the following server is chosen for the request: server back1 10.1.0.10:8080 check inter 2 then I'd like to receive this header on the 10.1.0.10 system: X-CustomHeader: back1 Is this possible? Regards, Dennis >>> >> >> > >
Re: Adding backend server name as request header
Hello I looked into the doc to saw that we can put the directive in the backend this is what I added to my config http-send-name-header X-CustomHeader But from my user browser I never get this header is there something that I need to enable on the global section in order for this to be working ? HA-Proxy version 1.5.4 2014/09/02 Copyright 2000-2014 Willy Tarreau Build options : TARGET = linux2628 CPU = generic CC = gcc CFLAGS = -O2 -g -fno-strict-aliasing OPTIONS = USE_LINUX_TPROXY=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 USE_PCRE=1 TIA Guillaume --- Le 2016-05-12 à 14:29, Dennis Jacobfeuerborn a écrit : > This is exactly what I'm looking for, thanks! > I was looking at the variables in Section 7.3 as I didn't think there > would be a dedicated directive for this. Apparently I was wrong :) > > Regards, > Dennis > > On 12.05.2016 18:48, Mehdi Ahmadi wrote: >> It may be that your after: >> ``` >> http-send-name-header X-CustomHeader >> ``` >> Which would set the ID of the selected server into the header >> `X-CustomHeader`. >> See the documentation for further details. >> http://cbonte.github.io/haproxy-dconv/configuration-1.5.html >> >> >> >> On Thu, May 12, 2016 at 6:29 PM, Dennis Jacobfeuerborn < >> denni...@conversis.de> wrote: >> >>> Hi, >>> I'm wondering if there is a way to add the name of the server chosen for >>> the request as a request header i.e. if the following server is chosen >>> for the request: >>> >>> server back1 10.1.0.10:8080 check inter 2 >>> >>> then I'd like to receive this header on the 10.1.0.10 system: >>> >>> X-CustomHeader: back1 >>> >>> Is this possible? >>> >>> Regards, >>> Dennis >>> >>> >> > >
Re: Adding backend server name as request header
This is exactly what I'm looking for, thanks! I was looking at the variables in Section 7.3 as I didn't think there would be a dedicated directive for this. Apparently I was wrong :) Regards, Dennis On 12.05.2016 18:48, Mehdi Ahmadi wrote: > It may be that your after: > ``` > http-send-name-header X-CustomHeader > ``` > Which would set the ID of the selected server into the header > `X-CustomHeader`. > See the documentation for further details. > http://cbonte.github.io/haproxy-dconv/configuration-1.5.html > > > > On Thu, May 12, 2016 at 6:29 PM, Dennis Jacobfeuerborn < > denni...@conversis.de> wrote: > >> Hi, >> I'm wondering if there is a way to add the name of the server chosen for >> the request as a request header i.e. if the following server is chosen >> for the request: >> >> server back1 10.1.0.10:8080 check inter 2 >> >> then I'd like to receive this header on the 10.1.0.10 system: >> >> X-CustomHeader: back1 >> >> Is this possible? >> >> Regards, >> Dennis >> >> >
Re: Adding backend server name as request header
It may be that your after: ``` http-send-name-header X-CustomHeader ``` Which would set the ID of the selected server into the header `X-CustomHeader`. See the documentation for further details. http://cbonte.github.io/haproxy-dconv/configuration-1.5.html On Thu, May 12, 2016 at 6:29 PM, Dennis Jacobfeuerborn < denni...@conversis.de> wrote: > Hi, > I'm wondering if there is a way to add the name of the server chosen for > the request as a request header i.e. if the following server is chosen > for the request: > > server back1 10.1.0.10:8080 check inter 2 > > then I'd like to receive this header on the 10.1.0.10 system: > > X-CustomHeader: back1 > > Is this possible? > > Regards, > Dennis > >