fix: serve PWA icons with no-cache to prevent stale icon on Android

Icons were cached with immutable/30-day headers, so Chrome Android kept
serving the old placeholder even after new icons were deployed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ulas
2026-04-01 09:47:22 +02:00
parent 3544f4f36c
commit ac294628e8
+5 -1
View File
@@ -106,7 +106,11 @@ app.use(express.static(path.join(__dirname, '..', 'public'), {
lastModified: true,
setHeaders(res, filePath) {
const ext = path.extname(filePath).toLowerCase();
if (['.png', '.jpg', '.jpeg', '.ico', '.svg', '.webp', '.woff2', '.woff'].includes(ext)) {
const isPwaIcon = /\/icons\/(icon-|apple-touch-icon|favicon)/.test(filePath);
if (isPwaIcon) {
// PWA-Icons müssen bei Deployments sofort aktualisiert werden
res.setHeader('Cache-Control', 'no-cache, must-revalidate');
} else if (['.png', '.jpg', '.jpeg', '.ico', '.svg', '.webp', '.woff2', '.woff'].includes(ext)) {
res.setHeader('Cache-Control', 'public, max-age=2592000, immutable'); // 30 Tage
} else {
// HTML, JS, CSS, JSON, manifest, sw — immer revalidieren