Fix static file routing - prevent catch-all from intercepting static files

This commit is contained in:
nmemmert committed 2025-12-11 08:48:58 -05:00
1 parent 4bb0466f3a
commit a40cac4491
1 file changed
+6 -1
+6 -1
View File
@@ -395,7 +395,12 @@ app.use(express.static(path.join(__dirname, '../client/build'), {
}
}));
app.get('*', (req, res) => {
// Only serve index.html for non-file routes (no extension)
app.get('*', (req, res, next) => {
// If the request has a file extension, let static middleware handle it or 404
if (path.extname(req.path)) {
return next();
}
res.sendFile(path.join(__dirname, '../client/build/index.html'));
});