Re: client ip address

From: Benoit Plessis <max.maverick#maverick.eu.org>
Date: Fri, 11 Jul 2008 15:24:10 +0200


Rainer Sabelka a écrit :
> On Friday 11 July 2008 14:17:16 Johan Duflost wrote:
>
>> I developped a web service that is accessed through haproxy.
>> It works but I need to get the client ip at the web service side but
>> instead I get the ip of haproxy. Any idea on the way I can solve this
>> problem?
>>
>
> Add "option forwardfor" to your configuration.
> This will add an "X-Forwarded-For" request header which you can use in your
> backend servers to obtain the original IP-address.
>

Be carefull though, other proxy may add this header into the request.
It could be of the form: "192.168.1.145,56.82.14.97" (private IP added bya http proxy, then public IP of the proxy added by haproxy) and may be longer.
The ease the job here with an apache reverse proxy i added a delete header to
reset It before mod_proxy will set it up. I'm starting to study haproxy and you should look ad req[i]del to do the same.

--
benoit
Received on 2008/07/11 15:24

This archive was generated by hypermail 2.2.0 : 2008/07/11 15:30 CEST