[Mod_gzip] http 1.1 or 1.0 which to accept

Glenn mod_gzip@lists.over.net
Thu, 18 Mar 2004 19:13:30 -0500


On Thu, Mar 18, 2004 at 03:24:04PM -0800, Bob Jaques wrote:
> Right now we only allow 1.1 http for gzip compression. We turned on
> compression but
> don't see much of a drop in bandwidth.

There is a long-outstanding bug in the current stable release of
mod_gzip (fixed in CVS? I don't know) that errs a little too loosely
when deciding to send Vary: User-Agent or Vary: *  IIRC.

If the pages returned have Vary headers, you might even be using
MORE bandwidth than you did without mod_gzip compressed pages, since
many proxies won't cache those pages or are restricted in what they
can cache, and many browsers will re-request those pages more often.

> A lot of access to our site is people
> at work
> and I am wondering if most corporation firewalls, proxy server and the like
> are
> changing http to 1.0.
> 
> What are the risks in allowing http 1.0 - I see google allows it ?

A simple configuration is a balanced tradeoff to get some compression
to reduce bandwidth, while not breaking too many web browsers out there.
Here is my config (for Apache 1.3.29).  YMMV!

Cheers,
Glenn


LoadModule gzip_module        modules/mod_gzip.so

[ ... snip ... ]

# mod_gzip must be the last AddModule statement  --gs
AddModule mod_gzip.c

[ ... snip ... ]

## mod_gzip compresses content (faster content delivery, saves bandwidth)
<IfModule mod_gzip.c>
    mod_gzip_on                     Yes
    ## (default is Yes, send Vary, but specifying it for some reason turns
    ##  it off ?!  bug report filed)
    #mod_gzip_send_vary              On
    mod_gzip_add_header_count       Yes
    mod_gzip_dechunk                Yes
                                                                                
    mod_gzip_can_negotiate           No
    mod_gzip_update_static           No
    mod_gzip_static_suffix          .gz
                                                                                
    mod_gzip_minimum_file_size      300
    mod_gzip_maximum_inmem_size   60000
    mod_gzip_maximum_file_size  2000000
    mod_gzip_temp_dir          /var/tmp
    mod_gzip_keep_workfiles          No
                                                                                
    ## minimal included set of items to compress to avoid sending Vary * header
    ## This is very conservative and cooperates superbly with mod_expires
    ## caching headers.  (Netscape 4.0[678] will still have problems, but it
    ## only affects a fraction of a percent of hits (about 0.00015 == 0.015%)
    ## on (our server) with the settings below)
    mod_gzip_item_include           uri   \.s?html?$
    #mod_gzip_item_include          mime   ^text/
</IfModule>



On a specific popular site that is PHP-based but the author only uses
PHP to serve HTML (and not anything else, such as images, from PHP),
I specifically added the following.  Works very well for a largely
static site.


AddType image/x-icon .ico

<VirtualHost *>
    ServerName www.paperfolding.com
    ServerAdmin  [...snip...]
    DocumentRoot [...snip...]

    # 3600 = 1 hour
    # 86400 = 1 day
    # 604800 = 1 week
    # (image/x-icon is for favicon.ico)
    ExpiresActive on
    ExpiresDefault A86400
    ExpiresByType text/html A3600
    ExpiresByType text/plain A604800
    ExpiresByType image/x-icon A604800
    ExpiresByType image/gif A604800
    ExpiresByType image/jpeg A604800
    ExpiresByType application/pdf A604800

    <IfModule mod_gzip.c>
    mod_gzip_item_include           uri   \.php$
    </IfModule>
</VirtualHost>