apache-chess.conf.example 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # chess-io — reverse proxy for davidwindham.com/chess
  2. # ============================================================================
  3. #
  4. # The chess app is a long-running Node process (see the systemd unit below). It
  5. # is NOT served from the web docroot like the PHP/WordPress parts of the site —
  6. # Apache proxies /chess through to node on 127.0.0.1:8181, exactly the way
  7. # /radio is already wired.
  8. #
  9. # Add the block below to the EXISTING davidwindham.com <VirtualHost> (the same
  10. # one that serves WordPress). Do NOT create a new vhost for it — /chess has to
  11. # live under the main hostname so it is same-origin with the rest of the site;
  12. # that is what lets the client open its websocket with no hardcoded host and
  13. # keeps it from tripping mixed-content blocking on https.
  14. #
  15. # ---------------------------------------------------------------------------
  16. # Requirements
  17. # ---------------------------------------------------------------------------
  18. #
  19. # 1. Apache 2.4.47 or newer. The `upgrade=websocket` option on ProxyPass is what
  20. # carries the socket.io websocket; it was added in 2.4.47. Check with:
  21. # httpd -v (or: apachectl -v)
  22. #
  23. # 2. These modules enabled:
  24. # a2enmod proxy proxy_http proxy_wstunnel rewrite
  25. # (proxy_wstunnel is not strictly used by `upgrade=websocket`, but enabling
  26. # it does no harm and covers older config styles.)
  27. #
  28. # 3. The node app running with BASE_PATH=/chess and TRUST_PROXY=1 — see the
  29. # systemd unit at the bottom. The /chess prefix is kept on BOTH sides of the
  30. # ProxyPass on purpose: the app is mounted at /chess and expects to see it.
  31. #
  32. # ---------------------------------------------------------------------------
  33. # Paste inside <VirtualHost *:443> for davidwindham.com (and *:80 if you keep
  34. # a plain-http vhost that isn't a blanket redirect to https).
  35. # ---------------------------------------------------------------------------
  36. # chess: real-time chess on node, mounted at /chess.
  37. # Prefix kept on both sides; BASE_PATH=/chess tells the app to expect it.
  38. # upgrade=websocket carries socket.io at /chess/socket.io (needs httpd 2.4.47+).
  39. ProxyPass /chess http://127.0.0.1:8181/chess upgrade=websocket
  40. ProxyPassReverse /chess http://127.0.0.1:8181/chess
  41. # ---------------------------------------------------------------------------
  42. # Notes
  43. # ---------------------------------------------------------------------------
  44. #
  45. # * /embed/chrome.js (the shared header/footer) is served by Apache from the
  46. # WordPress docroot, NOT by this app. Nothing to configure here for it — the
  47. # page loads it root-relative and it already resolves alongside /chess.
  48. # DAW_ORIGIN is a LOCAL-DEV-ONLY shim and must stay UNSET in production.
  49. #
  50. # * No trailing-slash rule is needed in Apache: the app itself 301s /chess to
  51. # /chess/ so relative asset URLs resolve.
  52. #
  53. # * If the old chess.davidawindham.com subdomain vhost is still live, point it
  54. # at a redirect to https://davidwindham.com/chess/ once this is confirmed
  55. # working, so old game links don't dead-end.