Skip to content

Instantly share code, notes, and snippets.

Created November 28, 2011 16:45
Show Gist options
  • Save anonymous/1401035 to your computer and use it in GitHub Desktop.
Save anonymous/1401035 to your computer and use it in GitHub Desktop.
#Main frontend
frontend app 0.0.0.0:80
mode tcp
# allow for many connections, with long timeout
maxconn 200000
timeout client 86400000
default_backend webapp
# two URLs need to go to the node pubsub backend
tcp-request inspect-delay 500ms
tcp-request content accept if HTTP
use_backend sio_tcp if !HTTP
# Main frontend - secure side
frontend app-https
bind 0.0.0.0:7443 accept-proxy
mode tcp
# allow for many connections, with long timeout
maxconn 200000
timeout client 86400000
default_backend webapp-https
tcp-request inspect-delay 500ms
tcp-request content accept if HTTP
use_backend sio_tcp if !HTTP
# Flash policy frontend
frontend flashpolicy 0.0.0.0:843
mode tcp
default_backend sio_tcp
# This is just for your main application.
backend webapp
mode http
option httplog
option httpclose
option forwardfor
reqadd X-Forwarded-Proto: http
server nginx1s localhost:8000 check
# This is just for your main application.
backend webapp-https
mode http
option httplog
option httpclose
option forwardfor
reqadd X-Forwarded-Proto: https
server nginx1s localhost:8000 check
# Here, we have a bunch of settings in order to allow Websockets
# connections through HAProxy.
backend socket_io
mode http
option httplog
# long timeout
timeout server 86400000
# check frequently to allow restarting
# the node backend
timeout check 1s
# add X-Forwarded-For
option forwardfor
# Do not use httpclose (= client and server
# connections get closed), since it will close
# Websockets connections
no option httpclose
# Use "option http-server-close" to preserve
# client persistent connections while handling
# every incoming request individually, dispatching
# them one after another to servers, in HTTP close mode
option http-server-close
option forceclose
# just one node server at :8050
server node1 localhost:8050 maxconn 2000 check
# This is the same server as above, but accessed in TCP mode.
backend sio_tcp
mode tcp
server node2 localhost:8050 maxconn 2000 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment