Reuse sent cache-control for /badge/

This commit is contained in:
Thaddee Tyl 2015-08-29 14:00:33 +02:00
parent 0c216cbe12
commit e477cb42a7

View File

@ -4125,9 +4125,13 @@ function(data, match, end, ask) {
incrMonthlyAnalytics(analytics.rawFlatSquareMonthly);
}
// Cache management - the badge is constant.
var cacheDuration = (3600*24*1)|0; // 1 day.
ask.res.setHeader('Cache-Control', 'public, max-age=' + cacheDuration);
if (ask.req.headers['cache-control']) {
ask.res.setHeader('Cache-Control', ask.req.headers['cache-control']);
} else {
// Cache management - the badge is constant.
var cacheDuration = (3600*24*1)|0; // 1 day.
ask.res.setHeader('Cache-Control', 'public, max-age=' + cacheDuration);
}
if (+(new Date(ask.req.headers['if-modified-since'])) >= +serverStartTime) {
ask.res.statusCode = 304;
ask.res.end(); // not modified.