From ac294628e8f989d8a225bfa25c301935bec719b9 Mon Sep 17 00:00:00 2001 From: Ulas Date: Wed, 1 Apr 2026 09:47:22 +0200 Subject: [PATCH] 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 --- server/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/index.js b/server/index.js index eae7b25..7a1ebec 100644 --- a/server/index.js +++ b/server/index.js @@ -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