SSE not streaming?
Separate connection failures, grouped arrivals, and early closes before changing your streaming setup.
In short: Separate three symptoms: no connection, events arriving
together, and an early end. Grouped arrival usually means a proxy, compressor, or client
is buffering; check each side with curl -N before changing your setup.
Last updated
Start with a control stream
Watch when each event arrives
NetOkay sends seven events over roughly 2.5 seconds. Compare the observed arrival gaps with the expected rhythm; this is a short browser-to-NetOkay check.
Run the SSE test →1. Separate three symptoms
- No connection: inspect the request, response status, and browser console. A failed fetch can have several causes; the page cannot identify a unique one.
- Events arrive together: compare arrival times. The observation alone cannot locate buffering in the application, a proxy, or the client.
- The stream ends early: check server logs and the application’s expected completion signal. An unfinished stream is not a completed test.
2. Compare the client with the upstream
For an SSE endpoint you operate, watch it from the affected terminal with curl’s output buffering disabled. Replace the example URL with your endpoint:
curl -N -i --max-time 15 https://example.com/events
This example assumes a public endpoint without authentication. Inspect the HTTP response and event boundaries. Curl’s time limit may stop a deliberately long-lived stream; that is different from an unexpectedly early server close.
If you can access the upstream directly, compare the upstream and proxied endpoint separately. A direct result helps locate a difference, but it does not prove the full browser path behaves the same.
3. If you use Nginx, review response buffering
Nginx can buffer proxied responses. For an SSE route you control, review the existing location configuration and consider this route-specific setting:
location /events {
proxy_pass http://127.0.0.1:3000;
proxy_buffering off;
}
Adapt the upstream to your deployment; do not replace unrelated route settings. An
upstream can also send X-Accel-Buffering: no, unless Nginx is configured to
ignore that header. See
Nginx’s response-buffering documentation.
Also inspect when the application flushes events, any other intermediary, and how the client reads the response. Turning off one buffer does not establish that the whole path is fixed.
4. Recheck the failing environment
A successful NetOkay stream leaves your application’s stream untested. Compare the browser and terminal, then inspect the original endpoint using its expected event protocol. The HTTP target command is a reachability step; SSE-specific templates are documented under CLI transports.