From 4b5899ff1aec8c6682585bd2789179da3eed40d2 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 15 Jul 2013 12:09:13 +0200 Subject: [PATCH] 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) .... --- lib/cartodb/server_options.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index 86c607f3..33fe8e87 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -213,18 +213,20 @@ 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 ) {