feat(server): add cache control headers for API responses to prevent browser caching
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m24s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m24s
This commit is contained in:
@@ -87,6 +87,12 @@ app.set('etag', false);
|
|||||||
|
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
res.setHeader('Access-Control-Expose-Headers', 'ETag, Last-Modified, Content-Length-Source');
|
res.setHeader('Access-Control-Expose-Headers', 'ETag, Last-Modified, Content-Length-Source');
|
||||||
|
// Запрещаем браузеру кешировать API ответы
|
||||||
|
if (req.path.startsWith('/api/')) {
|
||||||
|
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
||||||
|
res.setHeader('Pragma', 'no-cache');
|
||||||
|
res.setHeader('Expires', '0');
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user