Fix: JSON sanitize fuer Fragmente, bessere Anleitungen; Backend index.html Expires-Header

This commit is contained in:
2026-06-01 14:37:43 +02:00
parent 20c82f2fed
commit 57bf7e6944
2 changed files with 73 additions and 17 deletions

View File

@@ -88,6 +88,12 @@ app.use(express.static(PUBLIC, {
if (filePath.match(/\.(js|css)$/) && !filePath.includes('sw.js')) {
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
}
// index.html niemals cachen auch nicht über express.static
if (filePath.endsWith('index.html')) {
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
}
}
}));
@@ -95,6 +101,7 @@ app.use(express.static(PUBLIC, {
app.get('*', (_req, res) => {
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
res.sendFile(path.join(PUBLIC, 'index.html'));
});