Skip to content

Instantly share code, notes, and snippets.

@hellysmile
Forked from lackac/haproxy.cfg
Created November 30, 2012 02:23
Show Gist options
  • Save hellysmile/4173391 to your computer and use it in GitHub Desktop.
Save hellysmile/4173391 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment