server { listen 3000; server_name _; root /usr/share/nginx/html; index index.html; # Long cache for fingerprinted Next assets location /_next/static/ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # SSE endpoints. Buffering off + long read timeout so events flush # node-by-node instead of getting stuck in nginx's buffer. Heartbeats # every 15s on the Go side keep the connection alive. location ~ ^/api/(executions/[^/]+/stream|runs/stream)/?$ { proxy_pass http://flow:8090; proxy_http_version 1.1; 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_set_header Connection ""; # Disable everything that would prevent immediate event flushing. proxy_buffering off; proxy_cache off; proxy_read_timeout 24h; proxy_send_timeout 24h; chunked_transfer_encoding off; } # Regular JSON API. location /api/ { proxy_pass http://flow:8090; proxy_http_version 1.1; 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; } # Next static export uses trailingSlash=true; map directory paths to # their index.html. Try the requested URI, then the directory, then the # 404 page (Next's _not-found export). location / { try_files $uri $uri/ $uri.html $uri/index.html /index.html =404; } # Don't log the favicon nag location = /favicon.ico { log_not_found off; access_log off; } }