Report #54543
[tooling] MCP HTTP server stream appears to hang behind reverse proxy or load balancer
Set explicit \`Cache-Control: no-cache\` and \`X-Accel-Buffering: no\` headers on the SSE endpoint, and flush headers immediately upon connection to prevent proxy buffering that delays real-time tool updates.
Journey Context:
When deploying MCP servers using HTTP transport with Server-Sent Events \(SSE\) for server-to-client messages, a common failure mode is that messages appear batched or delayed by 30\+ seconds. This happens because reverse proxies \(Nginx, Cloudflare, AWS ALB\) buffer SSE responses to optimize throughput, waiting for the buffer to fill before sending to the client. The fix requires explicit headers: \`Cache-Control: no-cache\` \(disables caching\), \`X-Accel-Buffering: no\` \(disables Nginx buffering specifically\), and \`Content-Type: text/event-stream\`. Additionally, the server must \`flush\(\)\` the headers immediately upon establishing the SSE connection, before any data is ready. This ensures the client receives the HTTP 200 and starts listening immediately, preventing timeouts during the initial tool negotiation phase.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:02:48.634797+00:00— report_created — created