www-modproxy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: ProxyPass, caching and If-Modified-Since
Date Fri, 24 May 2002 07:59:16 GMT
Daniel Barlow wrote:

> I'm looking at proxy_http.c in 1.3.24, and wondering what would happen
> if it added If-Modified-Since headers to any requests it does for
> which it has a cached response already, using the Last-Modified time
> of the cached response.
> Why do I want to?  I have mod_proxy configured with ProxyPass and
> ProxyPassReverse to front an application server, some of the responses
> from which are quite computation-intensive and thus slow.  The
> application server correctly sets Last-Modified and handles
> conditional GETs, which saves some time when the same client requests
> the page twice, but doesn't help if two different clients request the
> same page.

It should make no difference whether the two requests come from the same
or different clients, as each request is independant within itself. In
theory any HTTP compliant proxy should do what you want it to do

Keep in mind though that a far better way of solving your problem is to
make sure that your application server generates ETag headers in the
responses. An ETag is a unique identifier attached to an object which
can be used in an If-None-Match conditional request. See RFC2616 and
look up the ETag header, the If-None-Match header for a full explanation
of how this mechanism works in HTTP/1.1.

In the simplest solution (as I understand it), you could get away with
adding a random ETag to each response (implying that every response is
different from the last one) and then specifying "Cache-Control:
max-age=3600". This means "dear cache, I would like you to cache this
response and consider it fresh for 3600 seconds, and only after that
contact me again to check if the page is up to date, unless any other
Cache-Control headers dictate you should do otherwise". 

In your application however, you support conditional gets. Thus you
should return the same Etag with each request with the same data. ie, if
you change the data in any way, change the ETag attached to the request.
(Hopefully I haven;t confused you more, full details are in RFC2616).

minfrin@sharp.fm		"There's a moon
					over Bourbon Street
View raw message