haproxy not passing X_FORWARD_FOR on HTTP POST

Posted by Mark L on Server Fault See other posts from Server Fault or by Mark L
Published on 2010-05-25T12:56:53Z Indexed on 2010/05/25 13:02 UTC
Read the original article Hit count: 424

Filed under:
|

Hello,

I've setup HAProxy with the

option forwardfor

option so it'll pass on the user's IP to PHP via $_SERVER[ "HTTP_X_FORWARDED_FOR" ].

If the page request isn't a POST it's populated fine but if it is then it won't be populated. Any ideas where I've gone wrong?

Thanks everyone!

My whole HAProxy conf file for reference:

global
    log 127.0.0.1   local0
    log 127.0.0.1   local1 notice
    #log loghost    local0 info
    maxconn 4096
    #chroot /usr/share/haproxy
    user haproxy
    group haproxy
    daemon
    #debug
    #quiet

defaults
    log global
    mode    http
    option  httplog
    option  dontlognull
    retries 3
    option redispatch
    maxconn 4096
    contimeout  5000
    clitimeout  50000
    srvtimeout  50000

listen webfarm :80
    mode http
    balance roundrobin
    option forwardfor
    server webA 192.168.240.4 weight 1 maxconn 2048 check
    server webB 192.168.240.3 weight 1 maxconn 2048 check

listen smtp :25
    mode tcp
    option tcplog
    balance roundrobin

    server smtp 192.168.240.4:25 check

© Server Fault or respective owner

Related posts about php

Related posts about haproxy