Files
mcma-compose/nginx.conf
T
2026-06-06 13:08:05 +03:00

61 lines
1.9 KiB
Nginx Configuration File

# DEV reverse proxy — single entrypoint at http://localhost:80.
# / -> webui rsbuild dev server (with HMR websocket)
# /rsbuild-hmr -> webui HMR websocket channel
# /api/... -> backend API
# /health... -> backend health/readiness probes
#
# This is the DEV topology only. Production gets its own proxy in the future
# prod compose (the webui PROD image already self-serves static assets).
# WebSocket upgrade plumbing.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream webui_dev { server webui:3000; }
upstream api_dev { server api:8000; }
server {
listen 80;
server_name localhost;
# Large media uploads — don't choke on big files.
client_max_body_size 0;
# ---- backend -------------------------------------------------------
location /api/ {
proxy_pass http://api_dev;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_buffering off;
}
location /health {
proxy_pass http://api_dev;
proxy_set_header Host $host;
}
# ---- rsbuild HMR websocket ----------------------------------------
location /rsbuild-hmr {
proxy_pass http://webui_dev;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}
# ---- webui dev server (catch-all) ---------------------------------
location / {
proxy_pass http://webui_dev;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}