mod_deflate - Optimal configuration for most browsers
Solution 1:
I went ahead and researched this one out. After reading multiple tutorials and the Apache doc, I was able to piece together something substantial, which seems to work well. Using the list above, I put together a set of rules/declaratives which seem to handle compression with the mainstream content types:
<Location />
# Insert filter
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/javascript text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/x-javascript application/javascript
AddOutputFilterByType DEFLATE application/json
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
</Location>
For testing, I basically used TamperData for Firefox and turned on deflate logging for apache:
https://addons.mozilla.org/en-US/firefox/addon/tamper-data/
For Apache, add the following:
# For Testing Purposes
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
#LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html#deflatefilternote