Web Servers on Unix and Linux - (not) caching with mod_expires

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > October 2007 > (not) caching with mod_expires





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author (not) caching with mod_expires
C.

2007-10-24, 7:23 am

Hi all,

This one is bit techy so please bear with me....

We have to use apache 1.3 (as supplied by Oracle). I'm currently
trying to get our content to cache nicely at the browser. While I can
get the static content into the cache initially, the problem occurs
when the caching info expires - subsequently *every* reference to the
URL causes a conditional request and a 304 response. Running over
HTTPS this is a huge overhead. (I believe it should be possible to, in
theory to supply revised caching info with a 304 response - but in
practice I've not been able to work out how).

With a bit of experimentation I found that it was possible to get the
browser to perform an unconditional request on expiry by omitting the
'Last-modified' header from the original response - but 'Header unset
Last-modified' doesn't work on 1.3 (works OK on 2.0). If we had 2.0,
we could also remove the conditional parts of the request - IIRC there
is a 3rd party module to do this in 1.3, but that causes us warranty
problems.

(the previous paragraph is only partially relevant to my current
problem - but if anyone knows how to solve it, it makes the main issue
in this posting moot)

As an interim measure I've given up on dealing with the expired
scenario and I'm just trying to get it working first time around,
however mod_expires is setting a cache-control: max-age=... header
(this does NOT seem to be documented but confirmed from the source
code), which in combination with an old file stamp means that the
content is stale as soon as it gets to the browser:

HTTP/1.1 200 OK
Cache-Control: max-age=604800
Expires: Wed, 31 Oct 2007 08:43:42 GMT
Content-Type: image/gif
Last-Modified: Tue, 28 Mar 2006 15:18:37 GMT
Connection: Close
Content-Length: 146
Date: Wed, 24 Oct 2007 08:43:42 GMT
Accept-Ranges: bytes

(refreshing this causes a conditional GET and a 304 response)

Unfortunately it seems that mod_headers also fails to remove the
'cache-control' header (or does it before mod_expires inserts it).

Other than:
1) updating all the file mtimes
2) upgrading to 2.0
Is there any way to get around this?

TIA

C.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com