Add 404 handling for /src/ paths in production environment

This commit is contained in:
Torsten Schulz (local)
2025-12-05 09:09:30 +01:00
parent c9b38f9825
commit 9ee288fd93
6 changed files with 100 additions and 0 deletions

View File

@@ -106,6 +106,11 @@ if (IS_PRODUCTION) {
if (IS_PRODUCTION && (req.path === '/' || req.path === '/partners')) {
return; // Route wurde bereits behandelt
}
// In Production: /src/ Pfade sollten nicht existieren (404)
if (IS_PRODUCTION && req.path.startsWith('/src/')) {
res.status(404).send('Not found');
return;
}
// Nur für nicht-API und nicht-static Requests
if (!req.path.startsWith('/api') && !req.path.startsWith('/static') && req.path !== '/robots.txt' && req.path !== '/sitemap.xml') {
res.sendFile(join(distPath, 'index.html'));