cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bertrand Delacretaz" <>
Subject Not caching pages with continuations (was:...where is 304?)
Date Mon, 29 Jan 2007 10:10:56 GMT
On 1/29/07, Ard Schrijvers <> wrote:

> For high-traffic sites, we obviously want to use mod_cache, but, at the same time,
> mod_cache shouldn't cache pages with a continuation in it....

The problem is making the HTTP cache headers variable according to
which pipeline is executed.

But, in principle, you have to set the headers before any content is
written to the output, and at this point you might not know what kind
of caching you need.

The way I've been solving this is a follows:

a) In pipelines, actions or flowscript set request attributes to
indicate what type of caching is needed

b) A custom transformer at the end of the pipeline sets the HTTP cache
headers according to these request attributes

Now, you're not supposed to set headers at the end of the pipeline,
but anyway the serializer has to buffer the content to be able to set
the Content-Length header. So nothing is actually written to the
output before b) *if* the serializer returns true for
shouldSetContentType. also plays a role in
this, as headers set by internal pipelines are ignored.

Not sure if this solution can be defined as a best practice, as it's a
bit of a hack...but if works for me ;-)


View raw message