11 August 2014

Check Apache or Nginx Compression Is Working

If you go to the bother of setting up gzip compression on your webserver, it's a good idea to check it is actually working. It can make a pretty big difference to the responsive feel of a site, especially if the content is on the large size.

Using CURL, you pass a header indicating the client accepts gzip format files:

curl -I -H 'Accept-Encoding: gzip,deflate' http://website.to.check.com/

The -I switch gets only the document header information. The -H switch passes a custom header, in this case specifying the client accepts gzip output. If compression is working look for the following in the output:

Content-Encoding: gzip

or

Content-Encoding: deflate

If you don't see a Content-Encoding line, or it doesn't indicate gzip or deflate, then your webserver is not compressing your content.

blog comments powered by Disqus