ppt-tool/apache/deckforge.conf
Vadym Samoilenko 7c8b8cd369 Add production deploy script and Apache/Docker config
- deploy.sh: idempotent 12-step deploy for Ubuntu (prereqs, port
  conflict check, basePath patch, build, migrate, Apache + UFW setup)
- docker-compose.prod.yml: prod overrides (127.0.0.1 bindings, no nginx)
- apache/deckforge.conf: reverse proxy template with SSE support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 19:15:19 +00:00

68 lines
2.7 KiB
Text

# DeckForge Apache Virtual Host
# Reverse proxy to Docker services on localhost
# SSL is terminated by the upstream load balancer
<VirtualHost *:80>
ServerName optical-dev.oliver.solution
# Security headers
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-XSS-Protection "1; mode=block"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
# Max upload size: 100 MB
LimitRequestBody 104857600
ProxyPreserveHost On
ProxyRequests Off
# ----------------------------------------------------------------
# FastAPI backend — Apache strips the /ppt-tool prefix so FastAPI
# receives plain /api/v1/... paths (it has no basePath awareness)
# ----------------------------------------------------------------
ProxyPass /ppt-tool/api/v1/ http://127.0.0.1:API_PORT/api/v1/ timeout=1800
ProxyPassReverse /ppt-tool/api/v1/ http://127.0.0.1:API_PORT/api/v1/
# Swagger / OpenAPI
ProxyPass /ppt-tool/docs http://127.0.0.1:API_PORT/docs
ProxyPassReverse /ppt-tool/docs http://127.0.0.1:API_PORT/docs
ProxyPass /ppt-tool/openapi.json http://127.0.0.1:API_PORT/openapi.json
ProxyPassReverse /ppt-tool/openapi.json http://127.0.0.1:API_PORT/openapi.json
# Static files served by FastAPI
ProxyPass /ppt-tool/app_data/ http://127.0.0.1:API_PORT/app_data/
ProxyPassReverse /ppt-tool/app_data/ http://127.0.0.1:API_PORT/app_data/
ProxyPass /ppt-tool/static/ http://127.0.0.1:API_PORT/static/
ProxyPassReverse /ppt-tool/static/ http://127.0.0.1:API_PORT/static/
# SSE: disable buffering so streaming responses reach client immediately
<Location /ppt-tool/api/v1/>
RequestHeader set Connection ""
SetEnv proxy-sendchunked 1
SetEnv no-gzip 1
ProxyTimeout 1800
</Location>
# ----------------------------------------------------------------
# Next.js frontend — receives /ppt-tool/... paths intact
# (Next.js basePath="/ppt-tool" handles the prefix internally)
# Must come AFTER all /api/ and /static/ rules
# ----------------------------------------------------------------
# WebSocket support (HMR in debug, or any WS the app uses)
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/ppt-tool/(.*) ws://127.0.0.1:WEB_PORT/ppt-tool/$1 [P,L]
ProxyPass /ppt-tool/ http://127.0.0.1:WEB_PORT/ppt-tool/
ProxyPassReverse /ppt-tool/ http://127.0.0.1:WEB_PORT/ppt-tool/
# Root redirect
RedirectMatch ^/$ /ppt-tool/
ErrorLog ${APACHE_LOG_DIR}/deckforge-error.log
CustomLog ${APACHE_LOG_DIR}/deckforge-access.log combined
</VirtualHost>