You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@liege.ICS.UCI.EDU> on 1996/10/08 16:27:40 UTC

Re: set/unset Headers

> Any reason why mod_expires.c shouldn't be modified to send
> Cache-Control: as well as Expires: headers?  This behaviour was
> hinted at by Roy about a million years ago but was never added.
> What is the relationship between the Expires: header generated for
> a resource (human readable ctime() timestamp) and the max-age=????
> timeout?  Is there any reason why both E: and CC: shouldn't be
> present at the same time?

Good questions.  The Expires header is being fazed-out in favor of
Cache-Control, since the latter provides more accurate control of
caching behavior and is less susceptible to clock problems.  The effect
is that, for most cache-sensitive responses, the response should
include both a Cache-Control and an Expires.  The Expires will be
interpreted by HTTP/1.0 (hopefully non-broken) clients.  The Cache-Control
will be interpreted by any client that understands Cache-Control and
will disregard the Expires value (i.e., Cache-Control overrides it).

One aspect of the above is that the Expires value may be different
from the Cache-Control: max-age=value.  The reason for this is so
that a server can prevent an older HTTP/1.0 cache from caching the
response, while at the same time allowing an HTTP/1.1 cache to follow
less stringent requirements in Cache-Control.  For example,

   Date: Tue, 03 Sep 1996 15:37:16 GMT
   Expires: Tue, 03 Sep 1996 15:37:16 GMT
   Cache-Control: private, max-age=1800

would indicate to an HTTP/1.0 client that the response is not cachable,
but would indicate to a cache-controllable client that the message can
be used in a non-shared cache with an expiration 30 minutes after receipt.

So, the moral of this story is that both should indeed be present, but
that they may have different values.

The one thing missing from use of a generic Header directive is the ability
to define an adaptive expiration based on Last-modified.  Ideally, we
could include an expression syntax like

   Header set Cache-Control max-age=[&relative_to_lmod(r, 2);]

whereupon the server would evaluate the function call relative_to_lmod(r, 2)
in order to obtain the value for max-age.  Now we are *really* talking
about a perl-based configuration. ;-)

I think just the simple "set this header to this" is sufficiently
flexible for 1.2.  I've been wanting this feature since '93 in order to
set the Owner header for MOMspider -- the possibilities are endless.

....Roy