Web Servers on Unix and Linux - Apache 2.0.x - Conflict in Expire and If-Modified-Since

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > February 2007 > Apache 2.0.x - Conflict in Expire and If-Modified-Since





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 Apache 2.0.x - Conflict in Expire and If-Modified-Since
florctn@gmail.com

2007-02-20, 7:16 am

I'm having a problem in setting Apache 2.0.59 to have both content
expiration and conditional processing.

The problem is that when a resource is declared expired in the browser
cache and is requesting again the resource from the server a Not
Modified respose is returned but without a new Expire date set.

This is making the browser, after the resource is expired, to request
every time the resource.
That makes the browser inefficient because is making requests to the
server even though is not necessary.

Is there any way to force Not Modfied respose to also set the new
Expire time?

Thanks.

C.

2007-02-21, 1:15 pm

On 20 Feb, 10:26, flor...@gmail.com wrote:
> This is making the browser, after the resource is expired, to request
> every time the resource.
> That makes the browser inefficient because is making requests to the
> server even though is not necessary.
>
> Is there any way to force Not Modfied respose to also set the new
> Expire time?
>


It's far from trivial to get the server to make a 304 response with
revised caching information (although the RFC rather implies that this
is how you should be solving the problem) - I recently did quite a lot
of work investigating this and managed to come up with a workable
solution.

There are two ways to do it - one is to provide an expires and a cache-
control: max-age but strip the last-modified header from the initial
content when it is served up so that the browser has no reference
point to base the max-age on. This works in all browsers I've tested
but strikes me as something of a hack. A better solution is to just
strip out the incoming if-modified-since header.

See the docs for mod_headers.

(if you can't tinker with your apache config then find /some/dir -exec
touch {} \; is a quick fix).

HTH

C.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com