Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 1.45 KB

File metadata and controls

33 lines (28 loc) · 1.45 KB
aliases author date tags title
/2008/09/19/compress-your-web-content-for-better-performance/
Major Hayden
2008-09-19 10:00:47 -0700
apache
development
web
Compress your web content for better performance

Most web developers expend a lot of energy optimizing queries, reducing the overhead of functions, and streamlining their application's overall flow. However, many forget that one of the simplest adjustments is the compression of data as it leaves the web server.

Luckily, mod_deflate makes this easy, and the Apache documentation has a handy initial configuration available:

<Location />
  SetOutputFilter DEFLATE
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  Header append Vary User-Agent env=!dont-vary
</Location>

This configuration will compress everything except for images. Of course, you can't test this with curl, but you can test it with Firefox and LiveHTTPHeaders. If you don't have Firefox handy, you can try a very handy web application that will give you the statistics about the compression of your site's data.