From 402fc90e630871f45908fd2979307d2acf6f5e7f Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 13 Mar 2013 12:01:35 +0100 Subject: [PATCH] Absence of X-Cache-Channel will be enough for Varnish to skip caching Do not override Cache-Control in this case, which means let the clients or geographical proxies cache the response with usual TTL. --- NEWS.md | 2 +- lib/cartodb/server_options.js | 4 ---- test/acceptance/server.js | 3 --- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 44e6e96e..51b83821 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ 1.1.9 ----- -* Handle SQL API errors by requesting no cache +* Handle SQL API errors by requesting no Varnish cache 1.1.8 ----- diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index ac1bc3bf..ef847306 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -70,10 +70,6 @@ module.exports = function(){ res.header('X-Cache-Channel', channel); cb(null, channel); } else { - // avoid caching this result - // (temptative, what Varnish does is out of our control) - res.header('Cache-Control', 'no-cache,no-store,max-age=0,must-revalidate'); - res.header('Pragma', 'no-cache'); console.log('ERROR generating cache channel: ' + ( err.message ? err.message : err )); // TODO: evaluate if we should bubble up the error instead cb(null, 'ERROR'); diff --git a/test/acceptance/server.js b/test/acceptance/server.js index 262d7663..4250c7de 100644 --- a/test/acceptance/server.js +++ b/test/acceptance/server.js @@ -986,9 +986,6 @@ suite('server', function() { assert.equal(ct, 'image/png'); // does NOT send an x-cache-channel assert.ok(!res.headers.hasOwnProperty('x-cache-channel')); - // attempts to tell varnish NOT to cache - assert.equal(res.headers['cache-control'], 'no-cache,no-store,max-age=0,must-revalidate'); - assert.equal(res.headers['pragma'], 'no-cache'); done(); } );