daily pastebin goal
5%
SHARE
TWEET

HAProxy config for socket.io

a guest Nov 23rd, 2011 824 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. defaults
  2.   log 127.0.0.1:514 local1 debug
  3.  
  4. # on client connection if policy file can be requested
  5. # from the same host on port 843.
  6. # You cannot use different port here.
  7. frontend flash_policy
  8.   bind 0.0.0.0:843
  9.   mode tcp
  10.   default_backend nodejs_flashpolicy
  11.  
  12. # Main frontend
  13. frontend proxy
  14.   bind 0.0.0.0:80
  15.   bind 0.0.0.0:8443
  16.   mode http
  17.   option httplog
  18.   # allow for many connections, with long timeout
  19.   maxconn 200000
  20.   timeout client 86400000
  21.  
  22.   # default to webapp backend
  23.   default_backend webapp
  24.  
  25.   #websockets
  26.   acl is_websocket path_beg /socket.io
  27.   acl is_websocket hdr(Upgrade) -i WebSocket
  28.   acl is_websocket hdr_beg(Host) -i ws
  29.   use_backend websocket if is_websocket
  30.  
  31. backend webapp
  32.    mode http
  33.    option httplog
  34.    option httpclose
  35.    server cherrypy1 localhost:7000 check
  36.  
  37. backend websocket
  38.   mode http
  39.   option httplog
  40.   # long timeout
  41.   timeout server 86400000
  42.   timeout queue 5000
  43.   timeout connect 86400000
  44.   # check frequently to allow restarting
  45.   # the node backend
  46.   #timeout check 1s
  47.   # add X-Forwarded-For
  48.    option forwardfor
  49.   # Do not use httpclose (= client and server
  50.   # connections get closed), since it will close
  51.   # Websockets connections
  52.   no   option httpclose
  53.   # Use "option http-server-close" to preserve
  54.   # client persistent connections while handling
  55.   # every incoming request individually, dispatching
  56.   # them one after another to servers, in HTTP close mode
  57.   option http-server-close
  58.   option forceclose
  59.   # just one node server at :8000
  60.   server node1 localhost:12000 maxconn 2000 check
  61.  
  62. backend nodejs_flashpolicy
  63.   mode tcp
  64.   server node1 localhost:10843 maxconn 2000 check
  65.  
  66.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top