diff --git a/src/backend/server/endpointListenbrainzRoutes.ts b/src/backend/server/endpointListenbrainzRoutes.ts index 2a273e0c..8cc4bbfe 100644 --- a/src/backend/server/endpointListenbrainzRoutes.ts +++ b/src/backend/server/endpointListenbrainzRoutes.ts @@ -17,7 +17,7 @@ export const setupLZEndpointRoutes = (app: ExpressWithAsync, parentLogger: Logge const nonEmptyCheck = nonEmptyBody(logger, 'LZ Endpoint'); const webhookIngress = new LZEndpointNotifier(logger); - app.useAsync(/(\/api\/listenbrainz.*)|(\/1\/submit-listens)/, + app.useAsync(/(\/api\/listenbrainz.*)|(\/1\/submit-listens\/?$)/, async function (req, res, next) { // track request before parsing body to ensure we at least log that something is happening // (in the event body parsing does not work or request is not POST/PATCH) @@ -59,5 +59,9 @@ export const setupLZEndpointRoutes = (app: ExpressWithAsync, parentLogger: Logge user_name: "Multi-Scrobbler" }) }); + app.useAsync(/\/1\/.*/, async function (req, res) { + logger.warn(`Received what looks like a Listenbrainz Endpoint request but it was to an invalid URL route: ${req.originalUrl}\nMake sure base URL path to MS endpoint is correct.`); + res.status(404); + }); }