{
  "id": 21934270,
  "title": "Stopping 404 Bot Scans at the Edge Before Your App Bundle Loads",
  "url": "https://urgent.news/2026/11/26/stopping-404-bot-scans-at-the-edge-before-your-app-bundle-loads",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-26T06:07:20.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/parimalmakes/stopping-404-bot-scans-at-the-edge-before-your-app-bundle-loads-36mk"
  },
  "original_language": "en",
  "account": "When managing full-stack applications hosted on serverless or edge workers, web servers often receive numerous requests targeting commonly targeted routes, such as /wp-login.php, .env files, and random PHP paths. On traditional virtual private servers, these unwanted requests are swiftly dropped by Nginx, causing minimal impact. However, on edge worker runtimes like Cloudflare Workers with Next.js, these probes can trigger the app handler, resulting in the rendering of a 404 error page. This hidden cost occurs because every unknown route necessitates the execution of routing, middleware, and potentially server-side rendering to inform the bot that the page does not exist. Similarly, webhook endpoints frequently face automated scanning with empty POST requests, prompting route handlers to parse the body, initialize database clients, and subsequently check signatures—wasting valuable CPU resources on insignificant traffic. To mitigate this issue, two straightforward checks can be implemented at the boundary before the framework even launches.\n\nFirstly, during the build process, generate a route allowlist by scanning route files and generating a static manifest of valid paths and dynamic route patterns. At the worker entry point, verify incoming GET requests against this manifest. If a request does not match any known route, promptly return a plain 404 response, avoiding server-side rendering (SSR), React trees, and unnecessary CPU usage.\n\nSecondly, for POST endpoints like payment webhooks, inspect the required signature headers at the edge before loading the route handler. If the necessary signature is absent, promptly return a 400 \"Bad Request\" response. This approach allows the real handler to focus on verifying the cryptographic signature, dropping unsigned probes almost instantly instead of waiting several hundred milliseconds. By filtering out these 404 scans and empty POST requests at the boundary, significant improvements in worker CPU limits and cold start spikiness can be achieved, ultimately reducing the overall system load.",
  "summary": "If you host a full-stack app on serverless or edge workers, your logs are probably full of requests for /wp-login.php , .env , and random PHP paths. On a traditional VPS, Nginx drops those fast and you barely notice. On a worker runtime like Cloudflare Workers running Next.js, those probes can wake up your app handler just to render a 404 page. The hidden cost of a 404 Every time an unknown route…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}