The moment a website goes live, uninvited guests start knocking every minute. None of them are there to read an article. Instead, they fire rapid bursts asking for .env, service-account.json, /wp-login.php, /actuator, /graphql, or /litellm - hunting for password files, cloud keys, and admin panels from completely different tech stacks that do not exist on an EmDash site.

None of this is a security breach waiting to happen. EmDash has no wp-login.php to brute-force and leaves no secret config files lying around in a public folder. The real nuisance is not the break-in attempt, it is the noise: without a bouncer at the door, EmDash dutifully spins up its engine for every made-up path just to render a nicely styled 404 error page. On compact, stateful setups like a Durable Object, heavy bursts eat into memory headroom; on high-traffic sites, they quietly inflate your cloud bill.

Both problems disappear in a few minutes - once Cloudflare turns junk traffic away at the front gate before EmDash even wakes up.

Why the bouncer works for free

On Cloudflare, every incoming request passes through a fixed sequence of phases: redirects first, then firewall rules (WAF), followed by the edge cache. Only at the very end does Cloudflare wake up your Worker - the actual application code that builds your site and gets billed by usage. If a firewall rule stops a request at the gate, the journey ends right there.

Illustration: A long corridor with four stations in a row: a signpost, a gate with an orange cloud as bouncer, a shelf of finished web pages and, at the far back, a workshop. Disguised figures pile up at the gate, while a real reader has already passed. At the back, the EmDash character and the database sleep with headphones on. On the left, a side door without a bouncer stands open, and a small figure peeks in.
What the firewall turns away never reaches the Worker. Only the workers.dev back door has no bouncer.
  • Your server stays asleep. Requests blocked by the WAF do not count as Worker invocations. They consume zero CPU milliseconds, trigger zero database queries, and touch zero bytes of memory.
  • Standard page caching cannot stop scanners. An edge cache shines when serving real pages that have already been visited. Made-up URLs like /.env.backup or /wp-config.php.old are never in the cache, so without a firewall rule every single probe punches straight through to your Worker.

One crucial detail belongs at the very top of your checklist: domain firewall rules only protect traffic arriving through that domain. Cloudflare's automatic .workers.dev subdomain bypasses zone WAF rules entirely. Whenever you run a custom domain, set workers_dev = false in your Wrangler configuration. Otherwise, you leave an unguarded side door wide open right next to your locked front gate.

What made-up URLs actually cost on serverless

Serverless pricing is fair, yet unforgiving: you pay for work performed - even when that work is completely pointless. Cloudflare's Workers Paid plan ($5/month) includes a generous 10 million requests and 30 million CPU milliseconds, meaning a small personal blog will comfortably absorb background noise for a long time.

As a site grows, however, it lands on more scanner lists and attracts larger botnets firing from thousands of IP addresses at once. Because rendering a dynamic 404 page still involves routing, layout logic, and database lookups (and even triggers two Worker invocations if you run a front-Worker in front of a Durable Object), sustained scanner fire quickly turns into real money.

With a matching WAF rule in place, that exact same barrage costs $0.00 - even on Cloudflare's Free plan.

Cost projection under sustained bot fire - and why spending limits are a trap

Beyond the included quota, Cloudflare bills $0.30 per million requests and $0.02 per million CPU milliseconds (excluding additional Durable Object or D1 reads). Assuming a conservative two-tier Worker setup (two invocations and roughly 8 ms of CPU time per uncached 404 render), non-stop scanner traffic scales up like this over a month:

Sustained scanner load

Monthly requests

Worker requests

CPU time

Total

1 million fake URLs / day

30M

$15

$4

$19

100 fake URLs / second

259M

$153

$41

$193

1,000 fake URLs / second

2.6B

$1,552

$414

$1,966

Many developers rely on Cloudflare's Workers usage limits as a safety net. In practice, that cap acts like a main circuit breaker rather than a shield: once tripped, Cloudflare shuts down every Worker across your entire account. A single runaway scanner draining your quota can take unrelated production projects offline along with it. On the Free Workers tier, hitting the 100,000 daily request cap has the exact same effect until midnight UTC.

Three repeat offenders knocking at the gate

Inspect the traffic logs of almost any domain - whether it is a busy tech publication or a small local club website - and the same three non-human characters show up again and again:

  1. Credential hunters with fake IDs: Operating out of major cloud data centers, these bots set their User-Agent header to trusted names like Googlebot, ClaudeBot, or GPTBot. Instead of reading articles, they methodically probe for .env files, forgotten debug panels from frameworks like Laravel or Spring, and exposed AI endpoints.
  2. Disguised smartphone scrapers: Headless browsers pretending to be mobile Chrome on an iPhone (CriOS), yet connecting from commercial server hosts like M247 or Vultr. They crawl thousands of pages and /_image URLs while quietly skewing your Real User Monitoring (RUM) speed metrics because their rented proxy connections are sluggish.
  3. Stubborn scripts in vintage disguises: Automated bots running out of large cloud networks that announce ancient mobile OS versions and forged referrers, bypassing edge caches on every hit and generating pure background load.

Rule 1: Block everything EmDash never uses

The most effective defense is also the simplest. EmDash is built on Astro: there is no PHP, no WordPress directory tree, and no configuration files sitting in a public web root. Anyone asking for them has zero legitimate business on your site and can be turned away immediately.

In the Cloudflare dashboard, head to Security -> Security rules -> Create rule -> Custom rules, click Edit expression to switch to the text editor, and paste the following rule:

txt
(ends_with(lower(http.request.uri.path), ".php"))
or (lower(http.request.uri.path) contains "/wp-")
or (lower(http.request.uri.path) contains "/.env")
or (ends_with(lower(http.request.uri.path), ".env"))
or (lower(http.request.uri.path) contains "/.npmrc")
or (lower(http.request.uri.path) contains "/.vercel/")
or (lower(http.request.uri.path) contains "/.next/")
or (starts_with(lower(http.request.uri.path), "/cgi-bin/"))
or (lower(http.request.uri.path) contains "/.git")
or (lower(http.request.uri.path) contains "/.aws/")
or (ends_with(lower(http.request.uri.path), ".yml"))
or (ends_with(lower(http.request.uri.path), ".yaml"))
or (ends_with(lower(http.request.uri.path), ".axd"))
or (lower(http.request.uri.path) contains "service-account")
or (lower(http.request.uri.path) contains "credentials")
or (lower(http.request.uri.path) contains "adminsdk")
or (lower(http.request.uri.path) contains "filemanager")
or (lower(http.request.uri.path) contains "/actuator")
or (lower(http.request.uri.path) contains "graphql")
or (starts_with(lower(http.request.uri.path), "/debug/"))
or (starts_with(lower(http.request.uri.path), "/_profiler"))
or (starts_with(lower(http.request.uri.path), "/_debugbar"))
or (starts_with(lower(http.request.uri.path), "/__debug__"))
or (starts_with(lower(http.request.uri.path), "/_ignition"))
or (starts_with(lower(http.request.uri.path), "/telescope"))
or (starts_with(lower(http.request.uri.path), "/litellm"))
or (starts_with(lower(http.request.uri.path), "/nacos"))
or (starts_with(lower(http.request.uri.path), "/flowise"))
or (starts_with(lower(http.request.uri.path), "/jenkins"))
or (starts_with(lower(http.request.uri.path), "/swagger"))
or (starts_with(lower(http.request.uri.path), "/api/proc/"))

Set the action to Block. Three details make this expression reliable in production:

  • Catching both .env patterns: Many blocklists only test for contains "/.env", letting probes for /docker.env or /config/settings.env slip right past the slash check. Pairing contains "/.env" with ends_with(..., ".env") closes that gap.
  • lower() is mandatory, not cosmetic: Cloudflare's rules language is strictly case-sensitive. Without lower(), a trivial /WP-LOGIN.PHP request walks right past the filter.
  • Works on the Free plan: Regular expressions (matches) require a Cloudflare Business plan. Because this expression sticks to contains, starts_with, and ends_with, it runs on Free and Pro zones alike - and at roughly 1,800 characters out of the 4,096-character limit, there is plenty of room left to grow.

Two quick checks for WordPress migrations and custom APIs

  • Recent WordPress migrations: Matching /wp- conveniently sweeps up /wp-login.php, /wp-admin/, and /wp-json/ in one line. If you still redirect legacy media URLs from /wp-content/uploads/, configure those redirects as Cloudflare Redirect Rules - they execute before the WAF phase anyway.
  • Custom endpoints: EmDash itself never touches any of the paths above. If you run a custom /graphql API alongside it on the same domain, remove that line first - or test the rule on Managed Challenge for a few days while checking your Security Events.

Rule 2: Catch disguised scrapers by combining signals

When a headless scraper disguises itself as a normal mobile browser, no single attribute is safe to block on its own. Combining the exact browser string with server-hosting network numbers (ASNs), however, isolates the bot cleanly:

txt
(http.user_agent contains "CriOS/144.0.7559.95")
and (ip.src.asnum in {9009 20473 36352 46261 62874 203020 204287 207990})

Set the action to Block (adjusting the specific browser version and ASNs to match whatever stands out in your own zone's Security Events).

The and operator does the heavy lifting here. Privacy-conscious human readers using commercial VPNs often exit through the exact same hosting providers (such as M247 or Vultr) that scrapers rent. Blocking those ASNs outright would lock out legitimate VPN users; blocking the Chrome version alone would hit real iPhone readers. Requiring both at once targets the scraper with surgical precision.

Rule 3: Challenge instead of blocking in gray areas

Whenever a suspicious pattern involves networks or older device strings where a real human might conceivably get caught in the crossfire, skip the hard block:

txt
(ip.src.asnum eq 132203 and http.user_agent contains "iPhone OS 13_2_3")

Set the action to Managed Challenge. Instead of slamming the door shut, Cloudflare runs a lightweight, mostly invisible browser check. Real visitors pass right through without clicking a thing, while bare-bones scripts hit a wall.

Four configuration traps worth avoiding

Clicking firewall rules together takes five minutes; spotting how they interact with modern frameworks and Cloudflare's automated features is where things get interesting. Watch out for these four traps.

1. Super Bot Fight Mode mistakes EmDash images for page views

Illustration: A reader sits on a park bench with a tablet and looks puzzled at an article. The text is there, but in every picture frame, instead of a photo, stands a small orange cloud bouncer with a raised hand. Behind the tablet, the EmDash character peeks out apologetically, holding a stack of pictures it cannot deliver.
The text got through. Every image got its own security check.

Starting on the Pro plan, Cloudflare offers Super Bot Fight Mode. As long as Static resource protection stays turned off, Cloudflare leaves images, stylesheets, and scripts untouched. The catch: Cloudflare decides whether a file is "static" strictly by looking for classic file extensions like .jpg, .png, or .webp.

EmDash serves resized images dynamically through Astro's image endpoint, producing URLs like /_image?href=...&w=700&f=webp. Because the path /_image has no file extension, Cloudflare treats every single photo inside an article like a full HTML page view. If a reader opens your post from an in-app browser over a VPN and triggers a security check, they pass the initial page challenge and see your text - only for every <img> tag in the background to silently receive its own challenge HTML instead of image data. The article renders, while every picture frame stays blank.

The clean fix is a narrow exception scoped strictly to image GET requests:

txt
(http.request.method eq "GET" and http.request.uri.path eq "/_image")

Choose Skip as the action, and tick only "All Super Bot Fight Mode rules" underneath - never "All remaining custom rules" or broad GET wildcards, which would quietly disarm bot protection across your entire site. (Note for Free plan users: basic "Bot Fight Mode" cannot be skipped via Custom Rules; if it blocks /_image requests, turning it off is the only option on Free.)

2. Why broad Skip rules and User-Agents never mix

Cloudflare's Skip action includes a tempting option called All remaining custom rules. Anything matching it bypasses every custom WAF rule positioned below it.

Pairing that option near the top of your rule list with a well-meaning allowlist based on User-Agent text (like Googlebot or ClaudeBot) rolls out the red carpet for scanners. Because User-Agent is just an unverified text header, bots routinely spoof crawler names and leapfrog straight over your blocklists.

Two golden rules prevent that:

  1. Keep your hard path block (Rule 1) at Position 1, above every single Skip rule.
  2. Never allowlist traffic based solely on User-Agent strings.

3. Verified bot categories vs. user-triggered AI assistants

To allowlist genuine search and AI crawlers safely, use Cloudflare's cryptographically and network-verified cf.verified_bot_category field instead of checking names:

txt
(cf.verified_bot_category in {"Search Engine Crawler" "AI Crawler" "AI Search"})

One nuance worth knowing: background indexers like Anthropic's ClaudeBot reliably carry the "AI Crawler" badge, whereas live fetches triggered when a human asks an AI chat assistant or CLI tool to read a specific URL (such as Claude-User) often arrive with an empty verified category today. Fortunately, our three rules above need no AI exception at all - no legitimate AI assistant has any reason to request /.env or /wp-login.php.

4. Scrapers warm the cache on the wrong continent

It is easy to assume that a busy scraper at least does you the favor of warming up your edge cache. In reality, Cloudflare caches assets locally per data center. A scraper running out of North American or Asian server farms fills cache shelves thousands of kilometers away from a European audience, leaving local edge nodes just as cold as before. If you run a dedicated cache warmer, always trigger it from the region where your actual readers live. I covered more of how edge caching behaves in Cold cache instead of cold start.

What you can safely skip (and what pairs well)

  • Skip blind rate limiting on Free: On the Free tier, rate limiting is tightly restricted (short windows, and checking whether a request missed the cache requires a Business plan). Because counters are tracked per data center, globally distributed botnets slip right underneath low thresholds anyway, whereas Rule 1 blocks junk paths globally on the very first hit.
  • Skip geoblocking: Blocking entire continents goes against the spirit of an open web - and barely dents scanner noise anyway, since plenty of automated waves originate right inside major European cloud regions.
  • Pair with 60-second 404 caching for post slugs: While Rule 1 stops foreign file extensions and framework probes for free at the WAF, bots occasionally guess plausible-looking article URLs without extensions. Starting in EmDash 1.6, missing post slugs are served from the edge cache for up to 60 seconds, keeping repeat misses away from your Worker too.

The complete ruleset in order

Order matters in Cloudflare's WAF, evaluated strictly from top to bottom:

Order

Rule

Action

Plan required

1

Paths and extensions EmDash never uses

Block

Free

2

Known scraper combinations (User-Agent + hosting ASN)

Block

Free

3

Suspicious legacy bot patterns in gray areas

Managed Challenge

Free

4

Exempt GET requests to /_image from bot checks

Skip (Super Bot Fight Mode only)

Pro

Cloudflare's Free tier includes five Custom Rules. Since Rule 4 is only needed on paid plans running Super Bot Fight Mode, the entire setup uses just three slots on a Free zone - leaving two rules in reserve. Filtering your Worker logs for stray 404s after a few days in production will quickly show if any exotic scanner paths deserve a spot in Rule 1.