Enable text compression high
Enable text compression (gzip/Brotli)
Text-based files are served uncompressed because gzip or Brotli isn't enabled, so transfers are several times larger than needed.
What you see
Enable text compression Text-based resources should be served with compression (gzip, deflate or brotli) to minimize total network bytes. Est savings of 870 KiB
What’s actually happening
HTML, CSS, and JS come down far larger than they should — a 600 KB JS file that would be ~150 KB gzipped arrives at full size. Lighthouse lists each uncompressed resource and the bytes you'd save. In the Network panel, click a text asset and compare "Size" (transferred) against "Content" (decoded); if they're equal, it's not compressed. The whole page feels slow on first load, and worse on mobile data.
Common causes
- Compression simply not enabled in the web server config (Nginx gzip off, Apache mod_deflate not loaded)
- A CDN or reverse proxy in front that isn't compressing, or that strips the Accept-Encoding header before it reaches origin
- MIME types missing from the compression allowlist, so JS/JSON/SVG pass through uncompressed while HTML gets compressed
- An origin behind a load balancer that terminates TLS and forwards plain HTTP without re-compressing
- Static files pre-served from object storage (S3, GCS) with no compression layer in front
How to fix it
- Confirm it's actually offcurl -I -H "Accept-Encoding: br, gzip" https://yoursite.com/app.js and look for Content-Encoding: br or gzip in the response. No such header means nothing is compressing it. Do this before changing config so you know what you're fixing.
- Turn on Brotli (with gzip as fallback)Brotli beats gzip on text by roughly 15-20%. Enable it where it's offered — Cloudflare and most CDNs have a toggle; Nginx uses the brotli module; Apache uses mod_brotli. Keep gzip enabled too so clients that don't advertise br still get compression.
- Cover every text MIME typeMake sure the allowlist includes text/html, text/css, application/javascript, application/json, image/svg+xml, and font formats that aren't already compressed. A common bug is HTML being compressed while JS and SVG slip through.
- Precompress static assets at build timeGenerate .br and .gz alongside each asset during the build (vite-plugin-compression, webpack CompressionPlugin) and serve them directly with gzip_static / brotli_static. You get maximum compression without paying CPU on every request.
- Check the proxy chain end to endIf there's a load balancer or proxy between the CDN and origin, confirm compression survives each hop. TLS-terminating proxies sometimes forward decompressed bodies; enable compression at the edge that actually serves the client.
Stop it recurring
Enable Brotli plus gzip at the edge/server as a default and verify Content-Encoding in CI or an uptime check so a config change can't silently turn it off.
Related errors