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. Check idle timeouts on the path
A stream that works for short responses can still be cut off during a long pause, for
example while a model is thinking before the next token. Proxies, load balancers and NAT
devices close connections that carry no bytes for a fixed period. Common defaults are
20–30 seconds on some application gateways and platform routers, 60 seconds on Nginx
(proxy_read_timeout) and AWS ALB, and 100 seconds on Cloudflare.
The homepage idle check sends one event, stays silent for 30 seconds, then sends a done event. If the stream closes during the silence, something between your browser and NetOkay enforces an idle limit under 30 seconds. If both events arrive together at the end, something held the stream until it finished. A pass only shows this browser survived one 30-second gap; longer pauses and your own upstream are not tested.
-
Find the first hop that closes idle streams: compare from a different network, then from
the failing environment with
curl -N. -
Raise the idle limit on hops you control (
proxy_read_timeout, load balancer idle timeout), or send periodic SSE comment lines (: keepalive) from your upstream so the connection never looks idle. - Hops you do not control still close streams at their own limit; a keepalive shorter than that limit is the only client-visible fix.
- Streaming an AI model? The AI API status pages list each provider’s keep-alive behaviour and typical pause lengths next to a live probe of its host.
5. 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.