httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <and...@aaaaaaaa.demon.co.uk>
Subject Two new modules (controlling Expires header)
Date Sat, 27 Jan 1996 14:29:33 GMT
Hi,

	I should really spend a couple more days bashing these 
but I'm losing next week with non-Apache business, er, I mean family
visits, and I've got a heap of work to do before I can break so...


CERN META FILES

I met some CERN devotees a couple of months ago and since then
they've been perstering me to fix Apache to do some more CERNesque
stuff.  I was holding off but it seemed timely to put in some effort
in light of recent conversations about Expires header control.

CERN has a general mechanism for providing additional per-file meta
information, in the form of additional MIME headers which can be
issued on a request.  Read the source and CERN's docs for more juice:

   http://www.w3.org/hypertext/WWW/Daemon/User/Config/General.html#MetaDir

...briefly if you want to add additional headers in the output 
for /foo/bar.html then:

1)	create directory /foo/.web
2)	edit the file /foo/.web/bar.html.meta giving valid MIME headers:

--- cut here save as /foo/.web/bar.html.meta ---
X-GodawfulKludle: Oh yes
Expires: Sat, 27 Jan 1996 14:52:41 GMT
--- cut here ---

You can add any kind of <foo>: <bar> header spec.  Even (god forbid)
headers that Apache is intending to send out anyway.  The order of
processing is a little random out there in module land but I'm
*guessing* you can add a line like:

Content-type: something/unique

and have it issued in preference to anything else that Apache
might decide is correct.  Certainly makes for an intriguing toy.
Uploaded to:

	httpd/incoming/mod_cern_meta.c_1.0.0



The example of using .meta files to influence Expires headers was
prompted by one of my CERN pals who really wanted to see more general
support for controlling Expires headers.  Which bring us to:


CONTROLLING EXPIRES HEADERS

I figured it'd be cool to have a general mechanism for controlling
the nature of the Expires headers issued on a server-wide per-directory
basis, issuing headers based on the content-type as well as providing
a default expiry date and being able to switch expiry behaviour on
or off.  There's more info in the module itself but briefly you
get 3 new directives to play with:

	ExpiresActive on | off
	ExpiresDefault <code><seconds>
	ExpiresByType type/encoding <code><seconds>

Which lets you put stuff like this in your .htaccess or conf files:

	# Bizzy development site, if you're gonna cache us
	# don't do it for long!
	ExpiresDefault M3600
	# pages are hot (1 week), images are cold (1 month)
	ExpiresByType text/html A604800
	ExpiresByType image/gif A2592000

here, the 'M3600' means, by default, to expire documents 3600
seconds (one hour) after their last 'M'odified date.  Similarly
all your gifs will  get expired 2592000 seconds (er, one week)
after they're 'A'ccessed from the server.

I'm not sure (after beating by brains out trying to figure out how)
that there needs to be a distinction between M and A here, but
that's for users to decide.  The module is uploaded as:

	httpd/incoming/mod_expires.c_1.0.0


Clearly there's some scope for both of these modules to interract
with the emerging proxying capability, so I would expect to modify
them slightly as people's ideas on the issue become more focussed.

Anyway, enjoy.

Cheers,
Ay.



Mime
View raw message