Skip to content

Instantly share code, notes, and snippets.

@jstrimpel
Created August 1, 2012 15:26
Show Gist options
  • Save jstrimpel/3227797 to your computer and use it in GitHub Desktop.
Save jstrimpel/3227797 to your computer and use it in GitHub Desktop.
old haproxy conf; one of many variations used to get socket.io and ngnix playing well together
global
maxconn 4096
pidfile /var/run/haproxy.pid
debug
defaults
mode http
frontend all
bind 0.0.0.0:80
maxconn 4096
timeout client 1h
default_backend www_backend
# Any URL beginning with socket.io will be flagged as 'is_websocket'
acl is_websocket path_beg /socket.io
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 socket_backend_http if is_websocket
#log 127.0.0.1:514 local0
backend www_backend
option httplog
option httpclose
balance roundrobin
option forwardfor
timeout server 30000
timeout connect 4000
server thin1 localhost:8000 weight 1 maxconn 1024 check
#server thin2 localhost:4002 weight 1 maxconn 1024 check
#server thin3 localhost:4003 weight 1 maxconn 1024 check
backend socket_backend_http
mode http
option httplog
#option http-server-close
option forceclose
no option httpclose
balance roundrobin
option forwardfor
timeout queue 5000
timeout server 86400000
timeout connect 86400000
timeout check 1s
server socket1 localhost:8001 weight 1 maxconn 1024 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment