title: HAProxy + WebSocket Disconnection
body: <p>I am using HAProxy to send requests, on a subdomain, to a node.js app. </p>
  
  <p>I am unable to get WebSockets to work. So far I have only been able to get the client to establish a WebSocket connection but then there is a disconnection which follows very soon after. </p>
  
  <p><em>I am on ubuntu. I have been using various versions of <code>socket.io</code> and <code>node-websocket-server</code>. The client is either the latest versions of Safari or Chrome. HAProxy version is 1.4.8</em></p>
  
  <p>Here is my HAProxy.cfg</p>
  
  <pre><code>global 
      maxconn 4096 
      pidfile /var/run/haproxy.pid 
      daemon 
  
  defaults 
      mode http 
  
      maxconn 2000 
  
      option http-server-close
      option http-pretend-keepalive
  
      contimeout      5000
      clitimeout      50000
      srvtimeout      50000
  
  frontend HTTP_PROXY
      bind *:80 
  
      timeout client  86400000
  
      #default server
      default_backend NGINX_SERVERS
  
      #node server
      acl host_node_sockettest hdr_beg(host) -i mysubdomain.mydomain
  
  use_backend NODE_SOCKETTEST_SERVERS if host_node_sockettest
  
  
  backend NGINX_SERVERS 
  server THIS_NGINX_SERVER 127.0.0.1:8081
  
  backend NODE_SOCKETTEST_SERVERS
  timeout queue   5000
  timeout server  86400000
  
  server THIS_NODE_SERVER localhost:8180 maxconn 200 check
  </code></pre>
  
  <p>I've trawled the web and mailing list but can not get any of the suggested solutions to work.</p>
  
  <p>(p.s. this could be for serverfault, but there are other HAProxy question on S.O, so I have chosen to post here)</p>