Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to route all requests containing a path directory of / to a separate port with HAProxy.

Here is my config file:

    maxconn     4096 # Total Max Connections. This is dependent on ulimit
    nbproc      2

    mode        http

frontend all
    timeout client 86400000
    default_backend web_servers
        acl is_stream path_dir
    use_backend stream_servers if is_stream

backend web_servers
    balance roundrobin
    option forwardfor # This sets X-Forwarded-For
    timeout server 30000
    timeout connect 4000
    server web1 weight 1 maxconn 1024 check

backend stream_servers
    balance roundrobin
    option forwardfor # This sets X-Forwarded-For
    timeout queue 5000
    timeout server 86400000
    timeout connect 86400000
    server stream1 weight 1 maxconn 1024 check

URL paths with a / get correctly directed to port 5100 in chrome and safari. However not for firefox.

I'm running Haproxy locally on my mac for dev, not sure if it has anything to do with it.

I'm using haproxy 1.4.8 and Firefox 3.6.15.

I've tried clearing cache on firefox and it didn't help, so I'm thinking there's something wrong with the way HAProxy parses through the Firefox request headers.

share|improve this question
Search into haproxy log, which backend is used with any browser. Maybe you can find other useful information. – lg. Mar 18 '11 at 9:38
up vote 2 down vote accepted

Most likely it's just because with this config, only the first request of a connection is analysed and other ones are simply tunnelled to the server. Enabling logs would show it. Just add "option http-server-close" to your defaults section and it should work. Ah also please remove "nbproc 2". It only complicates debugging and will not bring you anything.

share|improve this answer
I spent hours tracking this bug down, thank you so much for your answer! – LDK May 1 '12 at 3:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.