# Single-origin reverse proxy for XIP (Vireli pattern). # nginx serves the built SPA and proxies API + WebSocket to the bun backend. server { listen 80; server_name _; # Uploads: backend allows up to 50 MB (ABSOLUTE_MAX). Give headroom. client_max_body_size 60m; # ── API (REST + uploads) ──────────────────────────────────────────────── location /api/ { proxy_pass http://backend:3000; 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_read_timeout 120s; } # ── WebSocket (live feed + realtime stats) ────────────────────────────── location /ws { proxy_pass http://backend:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; 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_read_timeout 3600s; } # ── Health passthrough ────────────────────────────────────────────────── location = /health { proxy_pass http://backend:3000; } # ── Static SPA (Vue history fallback) ─────────────────────────────────── location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; } }