Menu

Next.js 16.4.6 Now Gzips Route Handlers. I Checked Streams, Downloads and Pre-Compressed Bodies
📰

Next.js 16.4.6 Now Gzips Route Handlers. I Checked Streams, Downloads and Pre-Compressed Bodies

DEV Community: nextjs·Sushil·6 days ago
#XMe4hCBW
#devtonextjs#devto#dev#route#gzip
Reading 0:00
15s threshold

Next.js 16.4.6 shipped overnight with a one-line release note: "Automatically compress route handler responses if not already compressed." If you self-host with next start , that's a real change. Your API routes were never gzipped before, and now they are.

Compression and streaming don't always mix, so I ran the same routes on 16.4.4, 16.4.5 and 16.4.6.

What changed

The fix is PR #101220 , backported in #101280 . Its description says route handler responses "were never compressed when self-hosted". Next stored single header values as one-element arrays, the compression middleware only accepts a string Content-Type , so every route handler response skipped compression. Pages were compressed all along.

How I tested

A small app built with next build and run with next start on Node 22.23.4. Requests come from a raw node:http client sending Accept-Encoding: gzip , so nothing gets decoded behind my back, plus plain fetch() to see what a normal client gets.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.