Dear All,
I have a problem with the logging of X-Forwarded-For header in my
/var/log/haproxy.log. In order to solve this I would like submit to your
attention these tests that I made :
The hosts :
Ha-Proxy 10.10.5.155
Sinatra web server - 10.10.5.65
Client - 10.10.5.93
- Test 1
1) Write the X-Forwarded-For using Sinatra (I can use Sinatra for setting
manually the value of 'X-Forwarded-For' ):
before do
response['X-Forwarded-For'] = '8.8.8.8'
end
2) Set in haproxy.cfg:
capture response header X-Forwarded-For len 50
capture request header X-Forwarded-For len 50
3) Below the logs with X-Forwarded-For taken from haproxy.log :
Dec 11 09:07:15 localhost haproxy[1585]: 10.10.5.93:53368
[11/Dec/2012:09:07:15.219] webserver sinatra/sinatra1 18/0/0/2/+20 404 +224 - -
---- 1/1/1/1/0 0/0
{sinatra.foo.org||it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4||Mozilla/5.0 (Windows NT
6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11}
{8.8.8.8|text/html;charset=utf-8|||} "GET /favicon.ico HTTP/1.1"
The test is ok!
- Test 2 to a Tomcat application
1) During the call to foo.test.org with TcpDump is possible see the
packets with X-Forwarded-For :
root@myvm1:~# tcpdump -vvv -A | grep X-
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535
bytes
X-Forwarded-For: 10.10.5.93 ( my client )
....
........
Is sure that some packets contain X-Forwarded-For
2) However I don't see X-Forwarded-For in /var/log/haproxy.log :(
Please , do you have a little advice for me?
Thank all for your attention and Best Regards,
Eugenio