fix: bypass static index.html serving to allow dynamic header path rewriting
All checks were successful
Build and Push Presejpacky Docker Image / build-and-push (push) Successful in 6s
All checks were successful
Build and Push Presejpacky Docker Image / build-and-push (push) Successful in 6s
This commit is contained in:
@@ -30,8 +30,15 @@ app.use((req, res, next) => {
|
||||
next();
|
||||
});
|
||||
|
||||
// Serve static files from the 'dist' directory
|
||||
app.use(express.static(path.join(__dirname, 'dist')));
|
||||
// Serve static files from the 'dist' directory, but bypass index.html requests
|
||||
// so they can be handled dynamically by our fallback route.
|
||||
app.use((req, res, next) => {
|
||||
if (req.url === '/index.html') {
|
||||
return next();
|
||||
}
|
||||
next();
|
||||
});
|
||||
app.use(express.static(path.join(__dirname, 'dist'), { index: false }));
|
||||
|
||||
// Fallback to index.html for Single Page Application routing, injecting base path from headers
|
||||
app.get('*', (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user