From ae09490aed3fd96e028b44cb460ae6fd8331d8d9 Mon Sep 17 00:00:00 2001 From: stefan judis Date: Tue, 28 Jan 2014 00:33:54 +0100 Subject: [PATCH] Added no-cache headers - fixes #28 --- server.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index 2b07f31..4d2b8b7 100644 --- a/server.js +++ b/server.js @@ -517,9 +517,6 @@ function(data, match, end, ask) { var color = escapeFormat(match[6]); var format = match[8]; - // Cache management. - 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. @@ -549,9 +546,6 @@ function(data, match, end, ask) { var status = match[2]; var color = data.color; - // Cache management. - 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. @@ -589,6 +583,9 @@ function getLabel(label, data) { } function makeSend(format, askres, end) { + // Cache management - no cache, so it won't be cached by Github's CDN. + askres.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); + if (format === 'svg') { return function(res) { sendSVG(res, askres, end); }; } else {