How can I tell if my server is serving GZipped content?

Johnny picture Johnny · Feb 4, 2012 · Viewed 80k times · Source

I have a webapp on a NGinx server. I set gzip on in the conf file and now I'm trying to see if it works. YSlow says it's not, but 5 out of 6 websites that do the test say it is. How can I get a definite answer on this and why is there a difference in the results?

Answer

zoul picture zoul · Feb 4, 2012

It looks like one possible answer is, unsurprisingly, curl:

$ curl http://example.com/ --silent --write-out "%{size_download}\n" --output /dev/null
31032
$ curl http://example.com/ --silent -H "Accept-Encoding: gzip,deflate" --write-out "%{size_download}\n" --output /dev/null
2553

In the second case the client tells the server that it supports content encoding and you can see that the response was indeed shorter, compressed.