Koskamo

Streaming LLM responses through proxies

Document v1 · Koskamo editorial · recorded 2026-09-21

Original source

Next.js streams responses when self-hosted, but a buffering proxy holds the stream until it completes. For nginx, disable buffering by sending the response header X-Accel-Buffering: no. Load balancers must support chunked transfer encoding or HTTP/2 streaming, and every reverse proxy between the load balancer and Next.js must pass chunked responses through without buffering. Koskamo field note: a token stream that arrives all at once at the end is almost always a buffering hop, not a slow model; test each hop separately. Scope: Next.js 16. Reviewed September 21, 2026.