server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Proxy WebSocket (must be before /api/ to take priority) location /api/v1/status/ws/ { proxy_pass http://backend:8000; 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 API to backend location /api/ { proxy_pass http://backend:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } # Proxy legacy /ws/ path location /ws/ { proxy_pass http://backend:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } # SPA fallback location / { try_files $uri $uri/ /index.html; } }