Closed-Loop Bot Blocking in Cloudflare & AWS WAF
WebDecoy closes the loop from detection to enforcement—pushing composite, auto-expiring rules to your Cloudflare or AWS WAF. Challenge first, block last.
integrationFrom one script tag to a rotation-proof lockout: the setup, the visitor experience, and the closed loop across a Cloudflare Worker and AWS WAF.
WebDecoy Team
WebDecoy Security Team
Most bot-mitigation vendors want to become your infrastructure — an inline proxy, a DNS cutover, a new single point of failure. WebDecoy takes the opposite bet: your edge already exists. Cloudflare fronts your traffic; AWS WAF guards your load balancers. What’s missing isn’t another hop — it’s a verdict worth enforcing. So WebDecoy supplies the verdict and your own edge carries it out: a Cloudflare Worker gates protected routes on session clearance, and AWS WAF holds the fingerprint rules for the bots that never run a browser at all.
Here’s the whole thing, from both sides of the request.
Copy the site key. In the dashboard under Integrations → Clearance setup, grab your site key — it’s publishable, so it goes straight into markup.
Add one script tag.
<script src=".../webdecoy.global.js" data-site-key="..." async></script>From now on, real browsers silently earn a wd_clearance cookie while they browse — minted in the background during idle time, no interstitial, no widget, nothing to click.
Deploy the edge validator. The Cloudflare Worker deploys to your zone with a single wrangler deploy. This is the piece that actually checks tokens on each request — and it fails open: if it can’t reach WebDecoy, it forwards the request untouched. The validator can slow a bot down; it can never take your site down.
Configure the policy. In the dashboard, scope which routes require a token — typically /login, /checkout, /api/*, not the whole site — and set up the two allowlist paths for legitimate tokenless clients: verified bots (Googlebot and friends, verified by published ranges and reverse DNS, never by User-Agent) and machine service tokens for your partners, monitors, and jobs.
Enforcement starts in monitor mode. Nothing gets blocked — but the validator tags every request with an x-wd-clearance header showing exactly what would have happened, and the audit log records the configuration as you build it. You watch the pass/challenge split until it looks right — real users passing, automation getting flagged — and then flip the toggle to enforce. That’s the whole cutover.
The daily surface is small: watch detections, the deny-list, and the audit log. Issue a machine credential for a new partner; one-click revoke one that leaked. Manually deny a fingerprint that’s causing trouble, or lift a denial that’s expired its welcome. Every one of those changes lands in the audit trail with who did it — including the denies the system issued automatically.
The clearance gate is built for browser-shaped traffic — the hard case. But plenty of hostile traffic never runs a browser: datacenter scrapers, scripted probes, credential-stuffing tools. For those, Response Actions push rules straight into your AWS WAF Web ACL: a managed JA4 fingerprint rule that follows a confirmed rotating actor across every IP it uses, and expiring IP blocks for one-off offenders. Fingerprint rules are deliberately reserved for confirmed rotators — behavior no legitimate user population produces — so a shared fingerprint is never blindly blocked. And like everything else here, it supports a Count-only monitor mode before you let it bite.
Two layers, one detection brain: AWS WAF handles the bots that stand out at the TLS handshake; the clearance gate handles the ones that don’t.
This is the decision the edge validator makes on every request to a scoped route:
/checkout, they already carry a valid token and pass invisibly. Zero friction./login before their cookie exists, with enforcement on: a one-time invisible check mints the token and reloads. One extra beat, once. (In monitor mode they simply pass, tagged.)Here’s the payoff, and it’s the reason the feature exists.
Consider the sophisticated bot that’s good enough to pass the browser check. It minted a token. It’s sailing through your protected routes, indistinguishable — for now — from a customer. Then it touches one of your decoys: a link no human can see, a path no honest crawler follows.
Because it’s carrying the wd_clearance cookie, that decoy hit hands WebDecoy the token. WebDecoy denies the exact fingerprint the token is bound to, the live token is revoked within about a minute, and the client can’t mint another — on any IP, until the lockout expires. No one clicks a honeypot by accident, so this is proof, not a guess.
And “decoy” means every deception surface. The tripwires you plant with the SDK — hidden honeytoken links in your own pages — forward the session’s token on a violation and feed the identical deny path. Deliberately, nothing else does: heuristic rules like rate limits and filters never touch the deny-list, and the mint gate stays lenient. The turnstile lets almost everyone in; the tripwires and decoys are the pressure plates, and only stepping on one locks you out.
That’s the arc: detection (a decoy) feeds enforcement (a deny) that your own edge carries out (revoke, and refuse re-minting). You set it up once. The visitor never notices. And the scraper that beat the front door gets locked out the moment it touches a tripwire.
That closed loop is what makes enforcement rotation-proof without collateral damage to real users — the thing IP rules and fingerprint rules, on their own, structurally cannot do. We wrote up the architecture behind it in Closed-Loop Bot Enforcement in Your Cloudflare & AWS WAF, and the setup reference lives in the docs.
No — it fails open by design. The Cloudflare Worker checks each request's clearance, and if it can't reach WebDecoy for any reason, it forwards the request untouched. The worst-case failure mode is a few minutes of reduced bot filtering, never an outage.
Almost never. The SDK mints a clearance cookie silently in the background while a visitor browses their first page or two, so by the time they reach a protected route they already pass invisibly. The only exception is a visitor who deep-links directly to a protected route before the cookie exists — they get a one-time invisible check and a reload. One extra beat, once.
They pass through a verified-bot allowlist that is checked before the token requirement. Verification uses operator-published ranges and forward-confirmed reverse DNS — never the User-Agent string, which anyone can spoof. A cloud VM claiming to be Googlebot fails the check; the real Googlebot never sees a challenge.
The clearance gate runs as a Cloudflare Worker, so token enforcement currently requires your site behind Cloudflare. The AWS WAF layer is independent: WebDecoy pushes fingerprint rules and expiring IP blocks into your Web ACL whether or not you use the clearance gate, and detection works everywhere.
Nothing. Enforcement is keyed to the clearance token, which binds to the client rather than the address. A scraper on 10,000 rotating residential IPs still needs a valid token on every request to a protected route and can't mint one — and if it was sophisticated enough to earn a token and then tripped a decoy, its fingerprint is denied on every IP until the lockout expires.
Start in monitor mode, which is the default. Nothing is blocked; the edge validator tags every request with an x-wd-clearance header showing what would have happened, and the audit log records your configuration as you build it. When the pass/challenge split looks right in your data, flip the toggle to enforce.
WebDecoy closes the loop from detection to enforcement—pushing composite, auto-expiring rules to your Cloudflare or AWS WAF. Challenge first, block last.
integrationDeploy WebDecoy's edge sensor to Cloudflare in one click. Detect the crawlers a JavaScript tag can't see, and enforce before they hit your origin.
integrationIntegrate WebDecoy bot detection with your SIEM. Native support for Splunk, Elastic, CrowdStrike, Syslog, and CEF formats.
integrationLike this post? Share it with your friends!
Get a personalized demo from our team.