# Apache reverse-proxy snippet for the my.itcarrot.com Reverb (WebSocket) server.
# Target: AlmaLinux + cPanel/WHM, EasyApache 4 (EA4).
#
# IMPORTANT — do NOT hand-edit the live generated vhost file on cPanel. WHM
# regenerates it (SSL renewals, account changes, `/scripts/rebuildhttpdconf`),
# and any direct edit gets silently discarded — or, if it has a syntax error,
# httpd fails to restart and the whole site goes down (this already happened
# once). Use one of the two supported, persistent methods instead:
#
# Option A — WHM UI (simplest):
#   WHM -> Apache Configuration -> Include Editor -> pick domain
#   "my.itcarrot.com" -> paste the two <Location> blocks below (just the
#   directives, no <VirtualHost> wrapper) -> Update. WHM handles the rebuild.
#
# Option B — userdata drop-in file (same result, via SSH):
#   Create this exact file (path is cPanel's per-domain SSL vhost include):
#     /etc/apache2/conf.d/userdata/ssl/2_4/<cpanel_username>/my.itcarrot.com/reverb.conf
#   with just the two <Location> blocks (no <VirtualHost> wrapper) — i.e. the
#   content below this comment header. Then:
#     /scripts/rebuildhttpdconf
#     apachectl configtest        # verify BEFORE restarting
#     systemctl restart httpd
#
# Required EA4 modules (enable via WHM -> EasyApache 4 -> Customize, or):
#   dnf install ea-apache24-mod_proxy_wstunnel ea-apache24-mod_proxy_http
# (EA4 packages register their own LoadModule directives — nothing else to do)
#
# Reverb itself only listens locally (REVERB_SERVER_HOST=0.0.0.0,
# REVERB_SERVER_PORT=8099 in .env — reachable as 127.0.0.1:8099 from this same
# server, via the supervisor program in deploy/supervisor/my-itcarrot-reverb.ini).
# (Port 8099, not the Reverb default 8080/8088 — something else on this server
# was fighting for those two ports; moved off them rather than keep hunting.)
# These two blocks expose it on the public domain over HTTPS so browsers can
# connect. Matches these .env values (frontend, rebuild after changing):
#   VITE_REVERB_HOST=my.itcarrot.com
#   VITE_REVERB_PORT=443
#   VITE_REVERB_SCHEME=https

<Location "/app">
    ProxyPass "ws://127.0.0.1:8099/app"
    ProxyPassReverse "ws://127.0.0.1:8099/app"
</Location>

<Location "/apps">
    ProxyPass "http://127.0.0.1:8099/apps"
    ProxyPassReverse "http://127.0.0.1:8099/apps"
</Location>
