Next.js 16.4.6 Starts Gzipping Route Handler Responses on Self-Hosted Servers
Next.js 16.4.6 added automatic compression for route handler responses that are not already compressed, a change that affects apps self-hosted with next start. A developer tested routes on versions 16.4.4, 16.4.5 and 16.4.6, finding that JSON responses and server-sent event streams became gzipped in 16.4.6 while earlier versions sent them uncompressed. Streaming behavior held up, with chunks still arriving about every 500 milliseconds, though the tests covered only next start and not reverse proxies, CDNs or Vercel. The 16.4.5 security release had stripped Content-Length and encoding headers from route handler responses, and 16.4.6 does not restore Content-Length for PDFs, which are sent chunked. Handlers that set their own Content-Encoding header on pre-gzipped output were also affected, with 16.4.5 dropping the header so clients received raw gzip bytes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in