Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
HAProxy configuration with Websocket support
global
maxconn 4096 # Total Max Connections. This is dependent on ulimit
nbproc 2
log 127.0.0.1 local1 notice
defaults
mode http
log global
frontend all 0.0.0.0:80
timeout client 86400000
default_backend www_backend
acl is_websocket hdr(Upgrade) -i WebSocket
acl is_websocket hdr_beg(Host) -i ws
acl host_bibliaolvaso hdr_sub(Host) -i bibliaolvaso.hu
acl host_todomvc hdr_sub(Host) -i todomvc
use_backend bibliaolvaso_backend if is_websocket host_bibliaolvaso
use_backend todomvc_backend if is_websocket host_todomvc
backend www_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout server 86400000
timeout connect 4000
server nginx localhost:81
backend bibliaolvaso_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout queue 5000
timeout server 86400000
timeout connect 5000
server bibliaolvaso localhost:7777
backend todomvc_backend
balance roundrobin
option forwardfor # This sets X-Forwarded-For
timeout queue 5000
timeout server 86400000
timeout connect 5000
server todomvc localhost:3003

Please put proper comments so that if would be easy to understand what configuration line is playing what role.

@ghost

ghost commented Jun 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment