From 030e6ae902fd333b7c5385ea196de21cf597a153 Mon Sep 17 00:00:00 2001 From: faris Aljohari <83524184+farisaljohari@users.noreply.github.com> Date: Mon, 17 Feb 2025 18:43:43 -0600 Subject: [PATCH] Add middleware to ignore requests for robots*.txt files --- src/main.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.ts b/src/main.ts index 6dbfc45..914d41b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,6 +31,14 @@ async function bootstrap() { }), ); + // Middleware to ignore requests for robots*.txt files + app.use((req, res, next) => { + if (req.path.match(/^\/robots\d*\.txt$/)) { + return res.status(404).send('Not Found'); + } + next(); + }); + setupSwaggerAuthentication(app); app.useGlobalPipes(