“Web pages are becoming increasingly
complex with more scripts, style
sheets, images, and Flash on them. A
first-time visit to a page may require
several HTTP requests to load all the
components. By using Expires headers
these components become cacheable,
which avoids unnecessary HTTP requests
on subsequent page views. Expires
headers are most often associated with
images, but they can and should be
used on all page components including
scripts, style sheets, and Flash.”
As written in Yslow.
my question is how much time would be good to set in expire header for a website which has multiple stylesheets, Flash headers, Javascripts, images, PDF, MS Excel files, PPT etc.?
If I want to set same expire time on all things.
If your page resources (images/css/js) typically don’t change and are static you can set the expires header to something far out like 1 year.
For the pages themselves it really depends on the content. If you content changes very frequently you should make sure your expires header are not set that large otherwise your visitors will receive stale content.
If you think about a site like SO itself, the content changes so frequently that the expires header on the page is very small. From the headers, looks like they use a 60 second max age and have a expires header 1 minute out from the current.