Revert "Use a constant Last-Modified time with cache_policy=persist"

This reverts commit 4b5899ff1a.

The reason is that setting Last-Modified to a remote date in the past
triggers early expiration of cache (as max-age will be reached sooner)
This commit is contained in:
Sandro Santilli 2013-07-15 13:14:06 +02:00
parent 4b5899ff1a
commit 76c056c7a1

View File

@ -213,20 +213,18 @@ 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
//
// TODO: find out a real value, querying for most recent change in
// any of the source tables
res.header('Last-Modified', new Date().toUTCString());
}
// Set Last-Modified header
//
// Currently sets it to NOW
//
// 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 ) {