Advertisement
Guest User

HAProxy config for socket.io

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