Practices
Send your pages compressed so they arrive faster
Your server sends the page exactly as written, instead of compressing it in transit first.
Why does it matter?
Text compresses extremely well: a typical page shrinks to roughly a third of its size. That is the same content arriving in a fraction of the time, for free, with no change to how the page looks. On a phone on a weak signal this is the difference between a page appearing and a visitor leaving.
How would you notice it?
- Pages feel slow on mobile data but fine on office wifi.
- Your host reports high bandwidth use for mostly text content.
- Large pages arrive no faster after you remove images.
How do you fix it?
We learned this one the hard way while making our own homepage faster. One note about who should compress.
Stage 1
- Check whether compression is already on. Use a header checking tool against your own address.
Look for a response header named content-encoding. If it says br or gzip, you are already done.
https://www.whatsmydns.net/http-headers/example.comStage 2
- If you are on shared hosting with a control panel, look for a compression setting. On cPanel it is usually under Optimize Website; on Plesk it is under Apache and nginx settings.
- If you manage your own server, enable it in the web server config and restart.
Gzip works everywhere. Brotli is smaller but only understood by modern browsers, so enable both.
Compression declared twice garbles the page
We once had our own server layer declare gzip while the platform in front of it applied its own compression on top, so browsers received a double-encoded body and the page rendered as garbage, while every configuration file and every log looked correct. We found it only by asking what a browser actually receives instead of what our own headers claimed. Compression belongs to the layer that terminates the connection: if your platform already compresses, leave it to the platform, and test the downloaded bytes rather than the setting.
Source: Double-encoded transfer incident and remediation on noblemarketglobal.com
# nginx
http {
gzip on;
gzip_types text/html text/css application/javascript application/json;
gzip_min_length 1024;
brotli on;
brotli_types text/html text/css application/javascript application/json;
}Stage 3
- If your site is behind a CDN or platform host, compression is usually automatic. Check their setting before changing server config.
How do you check it worked?
Confirm it worked
Run the header check again and confirm content-encoding now reports br or gzip for your page. Re-run the Siege Test and confirm the text compression recommendation is gone.