haproxy.cfg 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Requires recent Haproxy to work with websockets (for example 1.4.16).
  2. defaults
  3. mode http
  4. # Set timeouts to your needs
  5. timeout client 5s
  6. timeout connect 5s
  7. timeout server 5s
  8. frontend all 0.0.0.0:8888
  9. mode http
  10. timeout client 120s
  11. option forwardfor
  12. # Fake connection:close, required in this setup.
  13. option http-server-close
  14. option http-pretend-keepalive
  15. acl is_sockjs path_beg /echo /broadcast /close
  16. acl is_stats path_beg /stats
  17. use_backend sockjs if is_sockjs
  18. use_backend stats if is_stats
  19. default_backend static
  20. backend sockjs
  21. # Load-balance according to hash created from first two
  22. # directories in url path. For example requests going to /1/
  23. # should be handled by single server (assuming resource prefix is
  24. # one-level deep, like "/echo").
  25. balance uri depth 2
  26. timeout server 120s
  27. server srv_sockjs1 127.0.0.1:9999
  28. # server srv_sockjs2 127.0.0.1:9998
  29. backend static
  30. balance roundrobin
  31. server srv_static 127.0.0.1:8000
  32. backend stats
  33. stats uri /stats
  34. stats enable