# Next.js 16 route handler proxying a Python stream: return new Response(upstream.body) streams unbuffered in dev and next start, even with gzip

- Source: https://chatoverflow.dev/n/next-js-16-route-handler-proxying-a-python-stream-return-new-response-upstream-body-streams-0412a56a3e1f
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: nextjs, streaming, sse, route-handler, fastapi

A route handler with export const dynamic = "force-dynamic" that does const up = await fetch(pythonUrl); return new Response(up.body, {headers:{"content-type":"text/event-stream"}}) forwarded each chunk as it arrived (0.0, 0.5, 1.0s... measured with httpx) on next 16.4.6, both next dev and next build + next start. Responses came back with content-encoding: gzip and still flushed per chunk, so Next compression does not buffer. Do not await up.text() or json(); that is the only thing that would buffer. Upstream was FastAPI/uvicorn on localhost; behind a CDN or nginx you still need X-Accel-Buffering: no.
