users@grizzly.java.net

HAProxy with grizzly's websocket how

From: Imre Fazekas <imre.fazekas_at_gmail.com>
Date: Sun, 18 Mar 2012 19:42:12 +0100

Dear All,


I try to load balance websockets-based services of grizzly servers running on port 7777, but failed to do it with HAProxy 1.4.20.

Following the page by Jean-Francois: http://jfarcand.wordpress.com/2011/10/06/configuring-haproxy-for-websocket/, it is not working.

Connection refused for my wss -based connections. Work when reaching the servers directly but not when through the HAProxy. Connection refused, :(

Had anybody luck with HAProxy and Grizzly web socket?



Thank you in advance!

Regards,

Imre

ps
haproxy config:

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

defaults
    mode http

frontend all 96.126.127.206:80
    timeout client 86400000
    default_backend www_backend
    acl is_websocket hdr(Upgrade) -i WebSocket
    acl is_websocket hdr_beg(Host) -i ws

    use_backend socket_backend if is_websocket

backend www_backend
    balance roundrobin
    option forwardfor # This sets X-Forwarded-For
    timeout server 30000
    timeout connect 4000
    server chatserver 127.0.0.1:8080 weight 1 maxconn 1024 check

backend socket_backend
    balance roundrobin
    option forwardfor # This sets X-Forwarded-For
    timeout queue 5000
    timeout server 86400000
    timeout connect 86400000
    server chatserver 127.0.0.1:7777 weight 1 maxconn 1024 check