Use a constant Last-Modified time with cache_policy=persist

After all if the client is asking for persistance it doesn't make
sense to set a different Last-Modified for different incoming
requests (even if we don't expect any) ....
This commit is contained in:
Sandro Santilli 2013-07-15 12:09:13 +02:00
parent afd4c3b460
commit 4b5899ff1a

View File

@ -213,11 +213,11 @@ module.exports = function(){
if ( req.params.token ) cache_policy = 'persist';
if ( cache_policy == 'persist' ) {
res.header('Cache-Control', 'public,max-age=31536000'); // 1 year
// Set Last-Modified header to a constant time in the past
res.header('Last-Modified', new Date(0).toUTCString());
} else {
var ttl = global.environment.varnish.ttl || 86400;
res.header('Cache-Control', 'no-cache,max-age='+ttl+',must-revalidate, public');
}
// Set Last-Modified header
//
// Currently sets it to NOW
@ -225,6 +225,8 @@ module.exports = function(){
// TODO: find out a real value, querying for most recent change in
// any of the source tables
res.header('Last-Modified', new Date().toUTCString());
}
me.generateCacheChannel(req, function(err, channel){
if ( ! err ) {