1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-08-16 16:40:30 +03:00

fix(core): Use Custom cache-control headers force cache-revalidation on /types/*.json (no-changelog) (#9981)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-07-09 17:09:31 +02:00 committed by GitHub
parent 0f495986f8
commit 761229e4d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -364,10 +364,18 @@ export class Server extends AbstractServer {
next();
}
};
const setCustomCacheHeader = (res: express.Response) => {
if (/^\/types\/(nodes|credentials).json$/.test(res.req.url)) {
res.setHeader('Cache-Control', 'no-cache, must-revalidate');
}
};
this.app.use(
'/',
express.static(staticCacheDir, cacheOptions),
express.static(staticCacheDir, {
...cacheOptions,
setHeaders: setCustomCacheHeader,
}),
express.static(EDITOR_UI_DIST_DIR, cacheOptions),
historyApiHandler,
);