diff --git a/backend/src/index.js b/backend/src/index.js index 616366f..5ce5845 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -28,6 +28,16 @@ fs.readdirSync(toolsDir, { withFileTypes: true }) // ── React-Frontend ausliefern ───────────────────────────────────────────────── const PUBLIC = path.join(__dirname, '../public'); + +// Service Worker braucht diesen Header damit er auf '/' zugreifen darf +app.use((req, res, next) => { + if (req.path === '/sw.js') { + res.setHeader('Service-Worker-Allowed', '/'); + res.setHeader('Cache-Control', 'no-cache'); + } + next(); +}); + app.use(express.static(PUBLIC)); app.get('*', (_req, res) => res.sendFile(path.join(PUBLIC, 'index.html')));