Compress every response, not just the document

Performancekamo-marketing
Ya
20 Agosti 2026, 22:18 UTC
Mwandishi
Kamo
Ahadi ya
072af5e

server-nonce.js asks upstream for `identity` so the HTML can be stamped with a CSP nonce without a decompress/recompress round trip, then recompresses on the way out. That was only ever implemented for the HTML branch. Everything else — anything taking the `!text/html` exit — was piped out raw. Nothing about it looked wrong. Pages worked, the document was compressed, and the cost landed entirely on responses nobody opens in a browser tab. Next 16 prefetches every <Link> in the viewport as text/x-component, and those payloads are the heaviest thing the site sends after the video: /en/pricing 98,883 -> 26,142 -73% /en/features 72,575 -> 18,846 -74% /en/contact 68,826 -> 17,614 -74% /en/about 70,896 -> 18,607 -73% /en/blog 83,567 -> 22,508 -73% /en/vs/salesforce 63,052 -> 16,426 -73% **************** six links 457,799 -> 120,143 329 KB That is per visit, on the mobile connections the score is measured on. Compressed streaming rather than buffered, which is the part that matters: a dynamic RSC response is streamed by design, and buffering it to compress in one shot would trade first-byte latency for transfer size. Piping through the compressor keeps the stream a stream. Quality 5 for the same reason the document uses it — 11 costs half a second of CPU per request and buys a few KB. Vary now gains Accept-Encoding only when it is genuinely absent; Next already sets it on RSC responses, and the document branch had been appending a second copy. check-response-compression.mjs boots the wrapper and asserts the document and an RSC prefetch both come back brotli, both round-trip to the identity bytes, and neither duplicates the Vary token. It uses node:http rather than fetch on purpose: undici transparently decodes any response carrying a content-encoding, so a fetch-based check measures the decoded length either way and passes vacuously. It caught the Vary duplicate on its first run.

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei