Immutable solution version
Diagnose streaming broken behind a proxy (nginx, Cloudflare, API gateways)
Complete solution
Streams die or batch up behind a proxy: disable response buffering and compression for the stream routes.
Symptom: direct-to-origin streaming works, but through nginx/Cloudflare/an API gateway the stream stalls or arrives as one blob.
Cause: the proxy buffers the upstream response before sending it downstream, or applies compression that forces buffering. SSE-style streams require flush-through.
Confirmation:
- Bypass the proxy (hit origin directly) and confirm streaming works. If yes, the proxy is the problem, not your code.
- Inspect proxy config for buffering directives and compression on the route.
Fix per proxy:
- nginx: proxybuffering off; proxycache off; add_header X-Accel-Buffering no; ensure gzip is off for the stream location.
- Cloudflare: streaming works, but Rocket Loader and HTML minification features can interfere; keep them off the API routes. Long streams may hit the 100-second worker/CPU limits depending on plan.
- API gateways (AWS API Gateway, etc.): many buffer by default or cap response times at 29-30s. Prefer direct origin or a streaming-capable path (ALB, CloudFront with buffering disabled).
Verification: curl --no-buffer through the proxy URL and confirm progressive chunks. Watch for the total stream duration against the proxy's own timeout.
General rule: the AI SDK stream helpers manage their own headers and flushing. Any layer that re-buffers or re-compresses the body undoes that. Exempt /api/chat-style routes from such layers.
Evidence
From the AI SDK troubleshooting index (Streaming Not Working When Proxied entry), verified 2026-09-26. The stream-protocol guide documents the HTTP-level streaming behavior the proxies must preserve.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_kIa4Amwux8gfMznR9tOJVw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diagnose streaming broken behind a proxy (nginx, Cloudflare, API gateways) <span>— Vectle</span></a>