I was wondering if someone here could help me determine the optimal standard configuration for using mod deflate with Apache. Basically, mod_deflate recommends using the following configuration for getting started right away:
Compress only a few types
AddOutputFilterByType DEFLATE text/html text/plain text/xml http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
However, just from reading the doc, you can customize this for all the browsers out there. In addition, you can customize mod_deflate for all different kinds of mime types. I was wondering if anybody out there has experimented with these settings and found a setting which is optimal for all browsers.
Another example Apache provides, but mention not to use if you don't understand all the config options:
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
I understand most of the configuration settings, and I would like to setup something similar. I wouldn't mind avoiding compression of images and other media which is already compressed. The details I have problems with, is understand how this reacts with all the different browsers out there, chrome, firefox, IE, Opera, etc... Obviously I'm not concerned with Netscape 4.X. I'm hoping somebody has tested all this already and might be able to recommend a good setting that meets this criteria.
I mean if it's just a matter of using the recommended setting in the doc, I'm fine with that, but I wanted to check just to be sure.
Just to provide a few additional details. We use Apache as a front to all of our webservices. For Example: confluence, git, gitweb, etc...
Tomcat and other services are proxied via Apache so we have configurations for virtualhosts, mod_proxy w/AJP, mod_ssl.
My company doesn't have a dedicated IT team so I have to set much of this up in my spare time. I would appreciate any input you can provide.
So just to state clearly what I'm asking, what is the optimal configuration for handling the basic content needs serving requests from Apache to mainstream browsers?
My list of basic content types so far:
- text/html
- text/plain
- text/xml
- text/x-js
- text/javascript
- text/css
- application/xml
- application/xhtml+xml
- application/x-javascript
- application/javascript
- application/json
Types which obviously don't need to be compressed:
- images - gif, jpg, png
- archives - exe, gz, zip, sit, rar