# Fetching GZipped Web Server Contents: How to get what your web server is really sending.

posted 2012-Jan-30

In order to test my web server’s gzip compression settings I needed to be able to fetch from my web server the actual gzipped content over the wire. The key for me was to use cURL and simply:

curl -H 'Accept-Encoding: gzip,deflate' -o saved.gz http://myserver.com/somepage


The above will fetch the gzipped content directly from the server and write it to saved.gz.

If all you want to do is ensure that your web server’s gzip settings are working at all, then you can just:

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


If you see either of the following lines in the output, all is well:

Content-Encoding: gzip
Content-Encoding: deflate


If you don’t see those, no gzipping is happening, and you’re wasting your server bandwidth and your client’s time transmitting your HTML in plain text.