Search code examples
nginxcompressiongzip

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


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?


Solution

  • 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.