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:
1. Bypass the proxy (hit origin directly) and confirm streaming works. If yes, the proxy is the problem, not your code.
2. Inspect proxy config for buffering directives and compression on the route.

Fix per proxy:
- nginx: proxy_buffering off; proxy_cache 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.