Step-by-step guide

Configure Next.js Streaming Behind Nginx

Preserve Next.js streaming through Nginx by disabling response buffering, checking every proxy layer, and testing chunk arrival.

By HostNextJS Editorial TeamReviewed by HostNextJS Technical Review Published Updated
01Typeguide
02Last reviewed
03Update policyReview every 90 days.
At a glance

Deployment sequence

  1. STEP 01

    Create a known streaming route

    Use Suspense or a controlled delayed response so chunk timing can be observed.

  2. STEP 02

    Disable proxy buffering

    Set proxy_buffering off for the relevant location or emit X-Accel-Buffering: no from Next.js.

  3. STEP 03

    Check every hop

    Review CDN, load balancer, compression, and upstream proxy behavior.

  4. STEP 04

    Measure at the client

    Confirm the first chunk arrives before the full response completes.

Next.js App Router streaming works when self-hosted, but Nginx buffers proxied responses by default. The reliable fix is to disable buffering for streaming responses and verify that every hop preserves incremental delivery.

Configure the response path

Next.js documents setting X-Accel-Buffering: no through response headers. Nginx also supports proxy_buffering off at the proxied location. Keep an appropriate proxy read timeout and use a proxy protocol version compatible with the rest of the stack. Do not disable request buffering unless upload behavior requires it; it is a different setting.

Find hidden buffering

A CDN, ingress, load balancer, compression layer, or second reverse proxy can still collect the response. Compare a direct request to the private Next.js port with requests through each successive layer. This isolates the first hop that changes chunk timing.

Test observable behavior

Use a route with a fast shell and deliberately delayed content. Inspect time to first byte and chunk arrival with a client that does not hide buffering. A correct page after the full delay does not prove streaming works; the shell must arrive before the delayed section.

Methodology

How this resource was produced

We follow the documented Next.js X-Accel-Buffering behavior and Nginx buffering semantics, then validate at the client rather than inferring from configuration.

Limitations
  • 01

    Nginx may not be the only buffering layer; CDNs and load balancers must be tested separately.

  • 02

    Disabling buffering does not make a route stream if the application produces one complete response.

Evidence

Sources and review record

Primary documentation checked for the material claims on this page. Product behavior and prices can change after the checked date.

  1. 01 · Next.jsHow to self-host Next.jsChecked July 12, 2026
  2. 02 · NGINXNGINX proxy bufferingChecked July 12, 2026
Next step

Turn the resource into a deployment decision.

Troubleshoot your proxy path