Hi,

I've stumbled upon a problem with balance(hdr), specefically with 
X-Forwarded-For.
When you use the config that I've attached, you get different results wheather 
you send a X-Forwarded-For or not.

The source IP does not change when I perform those queries, hosts did not 
change state:

curl http://www.foo.de/host.jsp -s
Stays always on the same server.

curl http://www.foo.de/host.jsp -s -H "X-Forwarded-For: x.x.x.x"
Jumps between the three hosts.

This is strange: I delete the header that is sent by the client on the frontend 
with reqidel and set a new one with "option forwardfor" - I expected the 
backend to balance based on that new header.

If my assumption was wrong, and the original header is used, then I should not 
jump between hosts when I am always sending the same header.

Something smells fishy here...is this a bug? A Feature? ;) Or misunderstanding 
on my part?


Thanks,

Craig


haproxy.cfg:
-------------------------------------------------------
global
user haproxy
group haproxy
maxconn 75000
log 127.0.0.1 local0
stats socket /var/run/haproxy.stat mode 600

defaults
        timeout client 300s
        timeout server 300s
        timeout queue 60s
        timeout connect 7s
        timeout http-request 10s

backend backend_btg
mode http
balance hdr(X-Forwarded-For)
option redispatch
option httpchk HEAD / HTTP/1.1\r\nHost:\ www.foo.de
server S43 192.168.x.43:80 weight 100 maxconn 16384 check inter 10000 fall 2 
rise 2
server S56 192.168.x.56:80 weight 100 maxconn 16384 check inter 10000 fall 2 
rise 2
server S76 192.168.x.76:80 weight 100 maxconn 16384 check inter 10000 fall 2 
rise 2

frontend frontent_btg
bind 0.0.0.0:8085
maxconn 30000
mode http
option httplog
reqidel ^X-Forwarded-For:.*
option forwardfor except 192.168.X.Y
option httpclose
log 127.0.0.1 local0
capture request header Host len 192

default_backend backend_btg


Reply via email to