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:
parent
afd4c3b460
commit
4b5899ff1a
@ -213,18 +213,20 @@ module.exports = function(){
|
|||||||
if ( req.params.token ) cache_policy = 'persist';
|
if ( req.params.token ) cache_policy = 'persist';
|
||||||
if ( cache_policy == 'persist' ) {
|
if ( cache_policy == 'persist' ) {
|
||||||
res.header('Cache-Control', 'public,max-age=31536000'); // 1 year
|
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 {
|
} else {
|
||||||
var ttl = global.environment.varnish.ttl || 86400;
|
var ttl = global.environment.varnish.ttl || 86400;
|
||||||
res.header('Cache-Control', 'no-cache,max-age='+ttl+',must-revalidate, public');
|
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){
|
me.generateCacheChannel(req, function(err, channel){
|
||||||
if ( ! err ) {
|
if ( ! err ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user