Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

Here is my config file:

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

defaults
    mode        http

frontend all 0.0.0.0:80
    timeout client 86400000
    default_backend web_servers
        acl is_stream path_dir socket.io
    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 127.0.0.1:4000 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 127.0.0.1:5100 weight 1 maxconn 1024 check

URL paths with a /socket.io/ 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

1 Answer 1

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

 
discard

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.