style: Add middleware to rewrite requests without /api prefix for reverse proxy compatibility
This commit is contained in:
@@ -12,6 +12,14 @@ const WS_PORT = 3002;
|
||||
app.use(cors());
|
||||
app.use(express.json({ limit: '5mb' }));
|
||||
|
||||
// Rewrite requests that arrive without /api prefix (from reverse proxy stripping it)
|
||||
app.use((req, res, next) => {
|
||||
if (!req.path.startsWith('/api') && req.path !== '/' && req.path !== '/health') {
|
||||
req.url = '/api' + req.url;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
// Initialize database
|
||||
db.initializeDatabase();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user