server { listen 80; location / { root /usr/share/nginx/html; index index.html; try_files $uri /index.html; } location /api/ { # Keep the /api prefix when forwarding (Flask routes are /api/*). proxy_pass http://backend:3001; proxy_http_version 1.1; # SSE support (important for your EventSource) proxy_set_header Connection ''; proxy_buffering off; chunked_transfer_encoding off; } }