Web - How to test that your webserver is serving gzip pages

When you want to set up your webserver you might want to use gzip. But how to test if it works ? I used to test some request with telnet, the problem is that it will always return without gzip, because you don’t specify that you can process the gzip binary returned. So the webserver don’t use it.

But there’s a solution available on all linux boxes. It requests headers only and specifies that it can handle gzip compression.

[pat@morbier ~]$ curl -I -H 'Accept-Encoding: gzip,deflate' https://www.google.fr
HTTP/1.1 200 OK
Date: Thu, 22 Oct 2015 20:43:51 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Content-Encoding: gzip
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: PREF=ID=1111111111111111:FF=0:TM=1445546631:LM=1445546631:V=1:S=fC4FmVP_nfyHFcQh; expires=Thu, 31-Dec-2015 16:02:17 GMT; path=/; domain=.gooogle.fr
Set-Cookie: NID=72=BCGcvqazQc29fY7FHL-speYp2BvkdEybm1FZsLynJ37sAQD3DsS3YijN1ymdMIdlFqTl8QpoKxSzpqk7SSqbwy7MYmKGAiPHGvYgaU0gdjqM9sGS4DYv361RK54E-YdMuxweo_6DVhcz10RBkrBSgMzCk2w7SoQ; expires=Fri, 22-Apr-2016 20:43:51 GMT; path=/; domain=.google.fr; HttpOnly
Alternate-Protocol: 443:quic,p=1
Alt-Svc: quic="www.google.com:443"; p="1"; ma=600,quic=":443"; p="1"; ma=600
Transfer-Encoding: chunked

The important part being :

Content-Encoding: gzip

If you get this in return, it means that the webserver uses gzip.