[RFC/Loggerhead] Set /static/ pages to expire in 1 week

Matt Nordhoff mnordhoff at mattnordhoff.com
Thu Aug 28 11:58:22 BST 2008


Michael Hudson wrote:
> Matt Nordhoff wrote:
>> Hi,
>>
>> This trivial patch sets the Expires and Cache-Control headers on
>> /static/ pages to 1 week. It's an "RFC" instead of a "MERGE" due to the
>> issues below.
> 
> Thanks.
> 
>> Potential issues:
>>
>>  * I don't know if 1 week is the best value. Personally, I'd prefer to
>> have the images expire in 1 month, since they change so infrequently,
>> but I'd also like to make sure the CSS and JS are more fresh than that.
>>
>>  * It's not configurable. I don't know why, but it's possible that
>> someone would want to change it, and the only way to do so is by hacking
>> on the code.
>>
>>  * I don't know when the cache_max_age argument was added to
>> paste.urlparser.make_static(), so it might break backwards compatibility
>> or something. It works in Paste 1.4, so I guess that's old enough?
> 
> Another approach would be to serve from/generate urls like
> /static$revno/ and then set "Expires: never" or however it's spelt.  Do
> you think that would make more sense?
> 
> Cheers,
> mwh

Oh, that's true. That's really the best solution, the only problems are
coding it (I certainly don't know how), and making sure it's fast enough.

There isn't really something like "Expires: never". Quoting the HTTP/1.1
RFC, "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."
-- 



More information about the bazaar mailing list