Skip to content

Instantly share code, notes, and snippets.

@truemped
Forked from sidupadhyay/sample.config
Created June 8, 2011 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save truemped/1014001 to your computer and use it in GitHub Desktop.
Save truemped/1014001 to your computer and use it in GitHub Desktop.
Sample HA Proxy Config for Tornado/Socket.io Backends
global
maxconn 10000 # Total Max Connections. This is dependent on ulimit
nbproc 2
defaults
mode http
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
option httpclose
frontend all 0.0.0.0:80
timeout client 86400000
acl is_websocket hdr(Upgrade) -i WebSocket
acl is_websocket hdr_beg(Host) -i ws
use_backend socket_backend if is_websocket # Filter for Websockets
default_backend www_backend
backend www_backend
balance roundrobin
cookie SERVERID insert indirect # Match requests to same machines, if possible
option forwardfor # This sets X-Forwarded-For
timeout server 30000
timeout connect 4000
server server1 localhost:8001 weight 1 maxconn 5000 cookie FE1 check
server server2 localhost:8002 weight 1 maxconn 5000 cookie FE2 check
backend socket_backend
balance roundrobin
cookie SOCKETID insert indirect # Match socket requests to same machines, if possible
option forwardfor # This sets X-Forwarded-For
timeout queue 5000
timeout server 86400000
timeout connect 86400000
server server1 localhost:8001 weight 1 maxconn 5000 cookie SCKT1 check
server server2 localhost:8002 weight 1 maxconn 5000 cookie SCKT2 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment