fix(webhooks): mount webhook routes in index.js before verifyCsrf
Webhook routes were only registered in app.js (the test factory) but not in index.js (the production entry point). POST /api/webhook/* was therefore falling through to the verifyCsrf middleware and being rejected with 403 in production.
This commit is contained in:
@@ -84,6 +84,7 @@ const embyRoutes = require('./routes/emby');
|
||||
const dashboardRoutes = require('./routes/dashboard');
|
||||
const historyRoutes = require('./routes/history');
|
||||
const authRoutes = require('./routes/auth');
|
||||
const webhookRoutes = require('./routes/webhook');
|
||||
const verifyCsrf = require('./middleware/verifyCsrf');
|
||||
const { startPoller, POLL_INTERVAL, POLLING_ENABLED } = require('./utils/poller');
|
||||
const { validateInstanceUrl } = require('./utils/config');
|
||||
@@ -252,6 +253,7 @@ function serveIndex(req, res) {
|
||||
// ---------------------------------------------------------------------------
|
||||
app.use('/api', apiLimiter);
|
||||
app.use('/api/auth', authRoutes);
|
||||
app.use('/api/webhook', webhookRoutes);
|
||||
|
||||
// All routes below this point require CSRF validation on mutating methods
|
||||
app.use('/api', verifyCsrf);
|
||||
|
||||
Reference in New Issue
Block a user