Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 54 lines (43 sloc) 1.446 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

defaults
  mode http
  timeout connect 5s
  timeout client 5s
  timeout server 60s

frontend proxy
  # listen on 80
  bind 0.0.0.0:80

  # allow for many connections, with long timeout
  maxconn 200000 # total maximum connections, check ulimit as well
  timeout client 24h

  # default to webapp backend
  default_backend webapp

  # is this a socket io request?
  acl is_websocket path_beg /socket.io
  acl is_websocket hdr(Upgrade) -i WebSocket AND hdr_beg(Host) -i ws
  use_backend websocket if is_websocket

backend webapp
  balance roundrobin # assuming that you don't need stickiness
  # allow client connections to linger for 5s
  # but close server side requests to avoid keeping idle connections
  option http-server-close
  server ruby1 localhost:3000 check

backend websocket
  balance source # balance based on source IP

  # options
  option forwardfor # add X-Forwarded-For

  # 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

  # timeouts are long
  timeout queue 5s
  timeout server 24h
  timeout connect 24h
  # just one node server at :8000
  server node1 localhost:8000 check
Something went wrong with that request. Please try again.