cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Huttar <>
Subject Re: adding expires headers with cocoon
Date Fri, 04 Sep 2009 19:56:43 GMT
On 8/7/2009 5:45 AM, Robby Pelssers wrote:
> Hi guys,
> I’m building a new cocoon app (cocoon2.2) and performance really comes
> into play so after reading
>  I’m trying to get an
> A-grade for all rules ;-)
> Now I’m focusing on “Add an expires or cache-control header” so I
> started googling around.  I was reading this thread
> about adding support for settings expires headers.  But reading the
> official cocoon documentation I did not found anything back.  Does
> cocoon have built-in support to do so and are there
> examples/documentation of how to accomplish this?
> And by the way… anyone who has experience with configuring ETags??
> Thx in advance,
> Robby Pelssers

I thought I'd forward to the list this reply from my colleague to
Robby's question:


Our web applications run on the 2.1 strain of Cocoon, so things might be
implemented slightly differently in 2.2.  But, it looks to me like they
are the same.

To add an Expires header, I use the action HTTPCacheAction:

There is also a 2.2 version of the page:

>>From the above webpage, the HTTPCacheAction is:
"This action adds the Last-Modified, Expires and Cache-Control HTTP
headers to the response.

This action will add the Last-Modified header to the response with the
time in which the request was executed, and an Expires header at a
specified time difference. Additionally, it will provide an extra
Cache-Control indicating the maximum age of the request as a delta
between the expiration and last modification dates."

In my Cocoon sitemap, I have declared multiple HTTPCacheAction actions,
each for a different length of time--i.e a no-cache, short-cache,
medium-cache, and long-cache.

Here is an example of declaring the long-cache action in the Cocoon sitemap:
	<map:action name="long-cache"

Once the actions are defined (and after a Cocoon restart), all I have to
do to use these them is to add the <map:act type="{name of
map:action}"/> element to the pipeline match that I want to have an
Expires header.

To use the long-cache map:action declared above, I add the <map:act
type="long-cache"/> element to a pipeline match:
	<map:match pattern="**.js">
		<map:act type="long-cache" />
		<map:read mime-type="text/javascript" src="javascript/{1}.js"

Hope this helps,
Rick Harman
Web Application Development
SIL International

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message