Hi! 
YES
http request already have X-Forwarded-For header and I want haproxy to set 
X-Client-IP, same value that incoming X-Forwarded-For.

-----Original Message-----
From: Jarno Huuskonen [mailto:[email protected]] 
Sent: Thursday, July 20, 2017 4:18 PM
To: Andrey Zakabluk <[email protected]>
Cc: [email protected]
Subject: Re: X-Real-IP = X-Forwarded-For

Hi,

On Thu, Jul 20, Andrey Zakabluk wrote:
> frontend http-in
>         bind *:4016
>         default_backend servers
>         mode http
>         option httplog
>         log global
>        option forwardfor
>        capture cookie SERVERID len 32
>        capture request header Host len 15
>        capture request header X-Forwarded-For len 15
>        capture request header Referrer len 15
>        capture response header Content-length len 9
>        capture response header Location len 15
>        http-request set-header X-Client-IP 
> req.hdr_ip([X-Forwarded-For])]

Can you explain what you're trying to do ?

Do you want haproxy to set X-Forwarded-For and X-Client-IP headers to clients 
src ip address ? (BTW you're mixing X-Client-IP and X-Real-IP).
Try: http-request set-header X-Client-IP %[src] or Does the http request 
already have X-Forwarded-For header and you want haproxy to set X-Client-IP to 
the same value that incoming X-Forwarded-For has ?

> -- but not help.

How it doesn't work ? X-Client-IP value is empty ?

-Jarno

> Andrey Zakabluk wrote on 12.07.2017:
> 
> > Hi! I Use
> > HA-Proxy version 1.5.12 2015/05/02
> > .
> > Need add in http package option X-Real-IP.  X-Real-IP should be 
> > equal X-Forwarded-For. X-Forwarded-For be in package.
> > I tried
> 
> >     frontend http-in
> >         bind *:4016
> >         default_backend servers
> >         mode http
> >         option httplog
> >         log global
> >        capture cookie SERVERID len 32
> >        capture request header Host len 15
> >        capture request header X-Forwarded-For len 15
> >        capture request header Referrer len 15
> >        capture response header Content-length len 9
> >        capture response header Location len 15
> >        http-request set-header X-Client-IP 
> > req.hdr_ip([X-Forwarded-For])]
> 
> My naive solution would be
> 
>    http-request set-header X-Real-IP req.hdr_ip([X-Forwarded-For])]

--
Jarno Huuskonen

Reply via email to