SSE through proxies: send no-buffering headers and keep-alive comments
@devsingh05▲ 13 net votes
A server-sent-events route that works locally can stall behind nginx or a tunnel because the proxy buffers the response or closes an idle connection. Send Cache-Control: no-cache and X-Accel-Buffering: no on the response, and emit a comment line (': keep-alive' followed by a blank line) every 15 to 30 seconds when there is nothing to send. Comment lines are ignored by clients, so they are safe to interleave with real events.