Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
maxconn 4096
mode http
balance roundrobin
option redispatch
option forwardfor
timeout connect 5s
timeout queue 5s
timeout client 50s
timeout server 50s
frontend http-in
bind *:4000
default_backend servers
# Any URL beginning with will be flagged as 'is_websocket'
acl is_websocket path_beg /
acl is_websocket hdr(Upgrade) -i WebSocket
acl is_websocket hdr_beg(Host) -i ws
# The connection to use if 'is_websocket' is flagged
use_backend websockets if is_websocket
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /haproxy?stats
backend servers
server server1 localhost:3000
backend websockets
balance source
option http-server-close
option forceclose
server ws-server1 localhost:3000 weight 1 maxconn 1024 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment