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.
This commit is contained in:
Sandro Santilli 2013-03-13 12:01:35 +01:00
parent fcd6d55ba4
commit 402fc90e63
3 changed files with 1 additions and 8 deletions

View File

@ -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
-----

View File

@ -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');

View File

@ -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();
}
);