haproxy.adoc 951 B

123456789101112131415161718192021222324252627282930
  1. [#haproxy-dns]
  2. = HAProxy
  3. :proxy: HAProxy
  4. include::partial$reverse-proxies/diagram.adoc[]
  5. This is a straightforward example of how to setup a DNS name based HAProxy setup for OliveTin.
  6. ./etc/haproxy/haproxy.conf
  7. [source,python]
  8. ----
  9. frontend cleartext_frontend
  10. bind 0.0.0.0:80
  11. option httplog
  12. use_backend be_olivetin_webs if { hdr(Host) -i olivetin.example.com && path_beg /websocket }
  13. use_backend be_olivetin_http if { hdr(Host) -i olivetin.example.com }
  14. backend be_olivetin_http
  15. server olivetinServer 127.0.0.1:1337 check
  16. backend be_olivetin_webs
  17. timeout tunnel 1h
  18. option http-server-close
  19. server olivetinServer 127.0.0.1:1337
  20. ----
  21. The `timeout tunnel 1h` is important: without it, HAProxy's default timeouts will close long-lived websocket connections. See xref:troubleshooting/err-websocket-connection.adoc#reverse-proxies-will-close-websockets[Reverse proxies will close websockets] if you see disconnects.