Remove cache_policy query param

This commit is contained in:
Raul Ochoa 2015-03-23 18:40:59 +01:00
parent 36ea58e750
commit d5e20ef558

View File

@ -11,7 +11,6 @@ var assert = require('assert');
// Whitelist query parameters and attach format
var REQUEST_QUERY_PARAMS_WHITELIST = [
'user',
'cache_policy',
'callback',
'map_key',
'api_key',
@ -207,11 +206,7 @@ module.exports = function(redisPool) {
req.profiler.start('addCacheChannel');
}
var res = req.res;
var cache_policy = req.query.cache_policy;
if ( req.params.token ) {
cache_policy = 'persist';
}
if ( cache_policy == 'persist' ) {
res.header('Cache-Control', 'public,max-age=31536000'); // 1 year
} else {
var ttl = global.environment.varnish.ttl || 86400;
@ -318,12 +313,8 @@ module.exports = function(redisPool) {
if (req.res && req.method == 'GET') {
var res = req.res;
if ( req.query && req.query.cache_policy == 'persist' ) {
res.header('Cache-Control', 'public,max-age=31536000'); // 1 year
} else {
var ttl = global.environment.varnish.layergroupTtl || 86400;
res.header('Cache-Control', 'public,max-age='+ttl+',must-revalidate');
}
var ttl = global.environment.varnish.layergroupTtl || 86400;
res.header('Cache-Control', 'public,max-age='+ttl+',must-revalidate');
res.header('Last-Modified', (new Date()).toUTCString());
res.header('X-Cache-Channel', cacheChannel);
}