mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-27 05:29:59 +00:00
15 lines
421 B
JavaScript
15 lines
421 B
JavaScript
|
|
import onHeaders from 'on-headers';
|
||
|
|
|
||
|
|
export function disableCache (req, res, next) {
|
||
|
|
res.header('Cache-Control', 'no-store');
|
||
|
|
|
||
|
|
// Remove the etag header when caching is disabled
|
||
|
|
// Unfortunately it's not possible to prevent the creation right now
|
||
|
|
// See this issue https://github.com/expressjs/express/issues/2472
|
||
|
|
onHeaders(res, function removeEtag () {
|
||
|
|
this.removeHeader('ETag');
|
||
|
|
});
|
||
|
|
|
||
|
|
return next();
|
||
|
|
}
|