# Reverse-proxy trailguide.lifestream.org -> local gunicorn (127.0.0.1:8020).
#
# Install this as a cPanel Apache "userdata" include for the SSL vhost:
#   /etc/apache2/conf.d/userdata/ssl/2_4/lifest74/trailguide.lifestream.org/trailguide.conf
# then, as root:
#   /scripts/ensure_vhost_includes --user=lifest74
#   /scripts/rebuildhttpdconf
#   systemctl restart httpd
#
# Requires mod_proxy + mod_proxy_http (EasyApache4 -> Apache Modules).

ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
ProxyTimeout 120

# The /ask route STREAMS the answer token-by-token. flushpackets=on pushes each
# chunk straight through instead of buffering it, and no-gzip stops mod_deflate
# from holding the stream back — together they preserve the live typing effect.
SetEnvIfNoCase Request_URI "^/ask" no-gzip=1 dont-vary
ProxyPass        /ask http://127.0.0.1:8020/ask flushpackets=on
ProxyPassReverse /ask http://127.0.0.1:8020/ask

ProxyPass        /    http://127.0.0.1:8020/ flushpackets=on
ProxyPassReverse /    http://127.0.0.1:8020/
