[Seaside] [YSlow] How to set expires in response header for css and js resources?

Adrian Lienhard adi at netstyle.ch
Fri Aug 24 15:29:07 UTC 2007



On Aug 24, 2007, at 16:41 , Sebastian Sastre wrote:
>
>
> 	To implement a systematic optimization like that we need to add the
> expiry header for the css and the js files.
>
> 	As they are inserted in the updateRoot: which is a process part of a
> response that explicitely needs a cache control of "no cache" I don't
> understand yet how we can set the expiration of only this two files  
> and not
> the rest of the html code. Can someone give me a glimpse on how to  
> achieve
> this?

Apache has an expires module (see http://httpd.apache.org/docs/2.2/ 
mod/mod_expires.html), which allows you to set the expires header  
field for selected types of files. For example:

ExpiresActive On
ExpiresByType text/css                  "access plus 2 days"
ExpiresByType text/javascript           "access plus 2 days"
....

In my experience this has a noticeable effect on the page load time.

Adrian


___________________
Adrian Lienhard
www.adrian-lienhard.ch


More information about the seaside mailing list