Admins eHow SysAdmin Tips & Tricks

September 5, 2012

How to verify mod_deflate, gzip working ?

Filed under: Apache — Tags: , , , — admin @ 12:42 pm

Lets say you have enabled compression in your web server by mod_deflate, gzip and now want to verify if the content is really compressed, here is how to do it :

1.Easy way :
Go to this link : http://www.gidnetwork.com/tools/gzip-test.php
Enter your website URL inside “Web Page URL” and click on “Check”

2.Technical way :
Make sure curl is installed on your server. then run following command (change yoursite.com to your own domain) :

curl -I -H 'Accept-Encoding: gzip,deflate' http://yoursite.com

what you should look for in output is this line :

Content-Encoding: gzip

if it is not there, the content is not compressed.
here is the output for AdminseHow :

root@x~# curl -I -H 'Accept-Encoding: gzip,deflate' http://www.adminsehow.com

HTTP/1.1 406 Not Acceptable
Server: ApacheBooster/1.3
Date: Wed, 05 Sep 2012 12:39:22 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 8740
Connection: keep-alive
X-Pingback: http://www.adminsehow.com/xmlrpc.php
Vary: Accept-Encoding,Cookie,User-Agent
X-Powered-By: W3 Total Cache/0.9.2.4
Content-Encoding: gzip
Last-Modified: Wed, 05 Sep 2012 12:39:22 GMT
X-Cacheable: YES
Accept-Ranges: bytes
X-Varnish: 1984902025
Via: 1.1 varnish
age: 0
X-Cache: MISS

The content is compressed. YAY 😀
PS : I know the response is “HTTP/1.1 406 Not Acceptable”, it is because of mod_security installed on server which prevents such simple automated requests to be served. but it doesn’t matter for our test.

Powered by WordPress