server { listen 80; server_name _; # Allow large uploads (e.g. videos) client_max_body_size 300m; root /usr/share/nginx/html; index index.html; # SSE notification stream — must disable buffering for real-time push location /notification/ { proxy_pass http://backend:8080; proxy_http_version 1.1; proxy_set_header Connection ''; proxy_buffering off; proxy_cache off; proxy_set_header Host $http_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 3600s; proxy_send_timeout 3600s; } # Health check location /healthz { proxy_pass http://backend:8080; proxy_http_version 1.1; proxy_set_header Host $http_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; } # SPA routing (Vue Router history mode) location / { try_files $uri $uri/ /index.html; } # Reverse proxy to backend (strip /api prefix) location /api/ { proxy_pass http://backend:8080/; proxy_http_version 1.1; proxy_set_header Host $http_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; } # Serve uploaded files via backend static route location /static/ { proxy_pass http://backend:8080/static/; proxy_http_version 1.1; proxy_set_header Host $http_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_buffering off; } }