From af1514d7275c5addd17e616b3560e1e720ee8e1b Mon Sep 17 00:00:00 2001 From: NiceygyLive Date: Mon, 4 Mar 2024 12:07:04 +0000 Subject: [PATCH] ignore bot requests --- src/worker.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/worker.js b/src/worker.js index 2e0b0fa..6f5e853 100644 --- a/src/worker.js +++ b/src/worker.js @@ -179,11 +179,17 @@ var worker_default = { if (url.includes('test/cron')) { //Run cron tests manually, used for debug return new Response(await cron(env, true, false)); - } - if (url.includes('favicon.ico')) { + } else if (url.includes('favicon.ico')) { //Ignore favicon requests return new Response(null, { status: 404 }); - } + } else if (url.includes('robots.txt')) { + //Ignore robots.txt requests + return new Response('User-agent: *\nDisallow: /', { + headers: { + 'content-type': 'text/plain', + }, + }); + } if (!url) { //Ignore empty requests console.log('Invalid request, redirecting to 404');