Revert "Set max-age=0 when using no-cache"
This commit is contained in:
parent
46b7f7a309
commit
7b6b541083
1
NEWS.md
1
NEWS.md
@ -1,6 +1,7 @@
|
||||
1.5.2
|
||||
-----
|
||||
* Keep numbers as such in JSON output (#100)
|
||||
* Revert max-age=0 in Cache-Control when using no-cache
|
||||
|
||||
1.5.1
|
||||
-----
|
||||
|
@ -262,13 +262,10 @@ function handleQuery(req, res) {
|
||||
if ( cache_policy == 'persist' ) {
|
||||
res.header('Cache-Control', 'public,max-age=31536000'); // 1 year
|
||||
} else {
|
||||
// don't cache the result !
|
||||
// NOTE: both Varnish and Cloudfront ignore this header,
|
||||
// X-Cache-Channel is for controlling Varnish
|
||||
// Cloudfront can only be skipped perturbating the URL
|
||||
//
|
||||
// TODO: set ttl=0 when tableCache[sql_md5].may_write is true ?
|
||||
var ttl = 3600;
|
||||
res.header('Last-Modified', new Date().toUTCString());
|
||||
res.header('Cache-Control', 'no-cache,max-age=0,must-revalidate,public');
|
||||
res.header('Cache-Control', 'no-cache,max-age='+ttl+',must-revalidate,public');
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -30,7 +30,7 @@ app.setMaxListeners(0);
|
||||
|
||||
suite('app.test', function() {
|
||||
|
||||
var expected_cache_control = 'no-cache,max-age=0,must-revalidate,public';
|
||||
var expected_cache_control = 'no-cache,max-age=3600,must-revalidate,public';
|
||||
var expected_cache_control_persist = 'public,max-age=31536000';
|
||||
|
||||
test('GET /api/v1/sql', function(done){
|
||||
|
Loading…
Reference in New Issue
Block a user