Re: haproxy & websockets

From: Laurie Young <laurie#new-bamboo.co.uk>
Date: Tue, 27 Apr 2010 10:24:20 +0100


Hi Dustin

We are doing something very similar. I have a sample of our config file below. However this is not perfect. We are seeing a lot of dirty connections for normal http traffic because of the long timeout, and we are having some, as yet not-fully-diagnosed issues with incorrectly terminated connections to the http backend.

However the websockets seem to be working fine.

frontend all 0.0.0.0:80
  #send most requests to normal http server   default_backend www_backend

  # sockets need a long timeout
  timeout client 86400000

  acl is_websocket hdr(Upgrade) -i WebSocket #check the Upgrade header   acl is_websocket hdr_beg(Host) -i ws #also check the host in case Upgrade header not set

  use_backend socket_backend if is_websocket

backend socket_backend
  balance roundrobin
  timeout queue 5000
  timeout server 86400000
  server socket1 localhost:8090 maxconn 200 check   server socket2 localhost:8091 maxconn 200 check

Laurie

On 27 April 2010 01:06, Dustin Moskovitz <moskov#asana.com> wrote:

> Our company is attempting to use haproxy to balance websocket requests and
> ran into a snag when trying to set up virtual hosts. Using acl rules to
> divide traffic between two backends is very straightforward and we're able
> to make it work when using http mode, but we need to use tcp for websockets.
> Otherwise the proxy never sends the response back to the client.
>
> Does anybody know of a way either to a) use haproxy in http mode with
> websockets (e.g. tell the proxy to send packets onward as it gets them from
> the backend) or b) create a host-based rule in tcp mode?
>
> Thanks,
> Dustin
>

-- 
Dr Laurie Young
Scrum Master
New Bamboo

Follow me on twitter: @wildfalcon
Follow us on twitter:  @newbamboo

Try our new Realtime web service: http://pusherapp.com!
Received on 2010/04/27 11:24

This archive was generated by hypermail 2.2.0 : 2010/04/27 11:30 CEST