Dev.to WebDev 🛠 Dev 👁 2 📖 2 min read

curl -I Told Me Gzip Was Off. It Wasn't.

Quick one from a speed check I ran on our own site on 5 December 2026. It's a small thing, but it can send you down the wrong debugging path for an hour. The false alarm I wanted to confirm our homepage was g

curl -I Told Me Gzip Was Off. It Wasn't.

Quick one from a speed check I ran on our own site on 5 December 2026. It's a small thing, but it can send you down the wrong debugging path for an hour.

The false alarm

I wanted to confirm our homepage was gzip-compressed, so I reached for the usual one-liner:

curl -sI -H "Accept-Encoding: gzip, br" https://www.wizbrand.com/

curl -I HEAD request output with no Content-Encoding header

No Content-Encoding header. My first thought: compression is off.

The real answer

Same URL, same moment, but a real GET that discards the body and prints the headers:

curl -s -o /dev/null -D - -H "Accept-Encoding: gzip, br" https://www.wizbrand.com/

curl GET request output showing Vary: Accept-Encoding and Content-Encoding: gzip

Content-Encoding: gzip, Vary: Accept-Encoding, and a Content-Length of 14593 bytes for a page that is about 62 KB uncompressed.

Why the two differ

curl -I sends a HEAD request. A HEAD response is supposed to carry the same headers as GET, but in practice the compression step often only runs when there is a body to compress. Depending on the server and module order, HEAD can come back without Content-Encoding even though every real page view is compressed.

So the rule I follow now:

  • Use GET (-o /dev/null -D -) when checking compression.
  • Always send Accept-Encoding. Without it, a correctly configured server should reply uncompressed.
  • Check Vary: Accept-Encoding while you're there.

And then I found a real one

Running the same GET against our WordPress tutorials section, on the same domain and the same Apache server, returned no Content-Encoding and Vary: accept,content-type. That one really is uncompressed. A browser-based checker agreed:

URL Compression Check result: tutorials page not compressed, 77.33% potential saving

239.62 KB of HTML sent as-is, an estimated 54.32 KB with gzip. The likely cause is the classic one: the compression rule lives in one app's config and not in the subfolder app's own .htaccess. I've flagged it for a fix.

TL;DR

# don't trust this for compression checks
curl -sI -H "Accept-Encoding: gzip, br" https://example.com/

# trust this
curl -s -o /dev/null -D - -H "Accept-Encoding: gzip, br" https://example.com/ \
  | grep -iE "content-encoding|vary"

If you'd rather not use a terminal, the free URL Compression Check does a real request and shows the method, sizes and savings. I also wrote up the Apache and Nginx side, with the five mistakes that silently break gzip, in Enable gzip on Apache and Nginx, then prove it worked.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.