|
Posted by Michael Winter on 03/08/06 17:30
On 08/03/2006 11:51, Jim Higson wrote:
[snip]
> Because the resource for a given URL never changes, browser cache is
> always safe to use and there is no need to revalidate. What are the
> best HTTP header(s) to use to indicate this, and how should they be
> set in Apache?
There is no specific method with to mark a resources as indefinitely
'fresh'. However, one can get close by sending an Expires header or a
Cache-Control: max-age directive set far into the future.
The RFC 2616 (HTTP/1.1) has a note on this practice:
To mark a response as "never expires," an origin server sends
an Expires date approximately one year from the time the
response is sent. HTTP/1.1 servers SHOULD NOT send Expires
dates more than one year in the future.
-- 14.21 Expires, RFC 2616
The directives below will prompt Apache to send both an Expires and
Cache-Control header, instructing caches to treat all PNG images
(image/png) as fresh for 365 days from the time of access. That is, each
time a request is made to the origin server, a different expiry date
will be calculated.
ExpiresActive On
ExpiresByType image/png A31536000
These directives require the mod_expires module.
Hope that helps,
Mike
--
Michael Winter
Prefix subject with [News] before replying by e-mail.
[Back to original message]
|