4
0

apache.adoc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. [#apache-path]
  2. [#apache-dns]
  3. = Apache HTTPD
  4. include::partial$reverse-proxies/diagram.adoc[]
  5. This is an example of how to setup a DNS name based Apache HTTPD proxy for OliveTin. It assumes OliveTin is running on localhost, port 1337.
  6. ./etc/httpd/conf.d/OliveTin.conf
  7. [source,apache]
  8. ----
  9. <VirtualHost *:80>
  10. ServerName olivetin.example.com
  11. ProxyPreserveHost On
  12. ProxyPass / http://localhost:1337/
  13. ProxyPassReverse / http://localhost:1337/
  14. # Optional: increase timeout for long-lived websocket connections.
  15. # The websocket endpoint is api/olivetin.api.v1.OliveTinApiService/EventStream (default may drop it).
  16. ProxyTimeout 600
  17. </VirtualHost>
  18. ----
  19. [NOTE]
  20. ====
  21. Apache's default proxy timeouts are short for long-lived connections. Without increasing them, the websocket to `api/olivetin.api.v1.OliveTinApiService/EventStream` is likely to disconnect regularly. OliveTin will attempt to reconnect automatically, but setting `ProxyTimeout` (or a per-route `timeout=` on the websocket `ProxyPass`) avoids unnecessary disconnects.
  22. ====
  23. Note, you virtual host should *not* include a DocumentRoot directive - httpd is just proxying OliveTin, not serving it's actual pages.
  24. If you proxy the websocket path explicitly, set a per-route timeout (place these *before* the general `ProxyPass /`):
  25. [source,apache]
  26. ----
  27. ProxyPreserveHost On
  28. ProxyPass /api/olivetin.api.v1.OliveTinApiService/EventStream ws://127.0.0.1:1337/api/olivetin.api.v1.OliveTinApiService/EventStream timeout=600
  29. ProxyPassReverse /api/olivetin.api.v1.OliveTinApiService/EventStream ws://127.0.0.1:1337/api/olivetin.api.v1.OliveTinApiService/EventStream
  30. # Optional global default for proxied backends
  31. ProxyTimeout 600
  32. ----