[Pmwiki-users] Suggestion for the sample-config.php

Reimer Behrends behrends
Thu Mar 18 19:05:30 CST 2004


On Thu, Mar 18, 2004 at 01:52:30PM -0700, Patrick R. Michaud wrote:
[Using PHP's built-in compression.]
> How about if I just add it to the standard default configuration, with an
> option to set $EnableCompressedOutput=0 for those who don't want it?

Okay, here is one problem with that. It is a non-issue in the current
configuration, but in combination with using If-Modified-Since or a
similar mechanism, it can actually _increase_ bandwidth consumption.

What's the problem?

PHP correctly sets a "Vary: Accept-Encoding" in the HTTP response when
you use gzip compression. This tells any intermediate caches that the
result depends on what the browser specified in the Accept-Encoding
header (specifically, that it understands gzip compression). Thus, when
a second browser (that does not understand gzip compression) requests
the page through a cache, it will not receive the unintelligible
compressed data, but the cache will request a fresh copy.

So far, that is not a problem. It is currently more or less a non-issue,
because PmWiki annotates each response with a Cache-Control directive
that limits caching, anyway. (Note that "Cache-Control: no-cache" does
not actually prevent caching; it only requires that the request be
reissued and validated, but the content can be reused on a 304 response.
To completely suppress caching, "Cache-Control: no-store" is necessary.)

The problem occurs when you use Internet Explorer, which just happens to
be the most popular browser in existence. IE's handling of the "Vary:
Accept-Encoding" response header is to throw away its locally cached
copy (this is a correct, but horribly lazy and inefficient
implementation). Any page with "Vary: Accept-Encoding" will be reloaded
each time you visit it. Therefore, using compression will effectively
make If-Modified-Since and friends useless.

More recent versions of PHP can suppress the "Vary" header (note that
this is exactly what sites like slashdot.org and nfl.com do, because
they prevent caching already). Older versions of PHP cannot do that.

			Reimer Behrends



More information about the pmwiki-users mailing list