Linux / Unix Curl: Find Out If a Website Is Using Gzip / Deflate
How do I find out if a web-page is gzipped or compressed using Unix command line utility called curl? How do I make sure mod_deflate or mod_gzip is working under Apache web server?
The syntax is: curl -I -H 'Accept-Encoding: gzip,deflate' http://example.com
OR curl -s -I -L -H 'Accept-Encoding: gzip,deflate' http://example.com
-s – Don’t show progress meter or error messages.
-I – Work on the HTTP-header only.
-H 'Accept-Encoding: gzip,deflate' – Send extra header in the request when sending HTTP to a server.
-L – f the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place.
http://example.com – Your URL, it can start with http or https.
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.