-
-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Description
Middleware localOptions.headers currently are ignored (only globalOptions.headers are used)
Lines 189 to 195 in f27cb2b
Object.keys(globalOptions.headers).forEach(function(name) { | |
res.setHeader(name, globalOptions.headers[name]) | |
}) | |
res.writeHead = function() { | |
// add cache control headers | |
if (!globalOptions.headers['cache-control']) { |
Also, following code is ignoring the possibility of cacheObject.headers['cache-control']
being a value previously overrided by global/localOptions, like e.g. max-age=0, must-revalidate
or no-cache
or maybe a max-age lower than that being currently set.
I mean, if there was global/localOptions.headers['cache-control'] that was used when caching response, i think it should be used when sending cached response
Lines 251 to 259 in f27cb2b
Object.assign(headers, filterBlacklistedHeaders(cacheObject.headers || {}), { | |
// set properly-decremented max-age header. This ensures that max-age is in sync with the cache expiration. | |
'cache-control': | |
'max-age=' + | |
Math.max( | |
0, | |
(duration / 1000 - (new Date().getTime() / 1000 - cacheObject.timestamp)).toFixed(0) | |
), | |
}) |
MFava91, seanconnollydev, sidgujrathi and Izook
Metadata
Metadata
Assignees
Labels
No labels