fix(security): explicitly set cache-control 'private' on any page where a header is built

This commit is contained in:
Julian Lam
2022-03-17 16:24:03 -04:00
parent 5f36ad3976
commit e39cdd490b
2 changed files with 7 additions and 0 deletions

View File

@@ -25,6 +25,8 @@ middleware.buildHeader = helpers.try(async (req, res, next) => {
if (req.method === 'GET') {
await require('./index').applyCSRFasync(req, res);
}
res.set('cache-control', 'private');
res.locals.config = await controllers.api.loadConfig(req);
next();
});

View File

@@ -44,6 +44,11 @@ middleware.buildHeader = helpers.try(async (req, res, next) => {
req.logout();
return res.redirect('/');
}
if (req.loggedIn) {
res.set('cache-control', 'private');
}
res.locals.config = config;
next();
});