← Policy library/Cloudflare WAF: Managing AI Crawlers at the Edge
Policy library

Cloudflare WAF: Managing AI Crawlers at the Edge

Enterprise guide to configuring Cloudflare WAF Custom Rules, Bot Management, and AI Crawlers protection to govern automated bot access.

AI Summary: Cloudflare WAF provides edge-level enforcement for AI crawler governance using custom firewall expressions. Publishers can distinguish between verified search bots, AI search crawlers, and bulk training scrapers using cf.bot_management and http.user_agent fields.

Edge-Layer Bot Governance with Cloudflare

Relying solely on origin web servers to handle bot traffic incurs substantial compute, bandwidth, and origin egress costs. Cloudflare inspects and filters traffic across its global Anycast network before requests ever touch your origin.

With Cloudflare's WAF and Bot Management suite, publishers can build granular rules that allow verified search crawlers while blocking bulk AI scrapers.

Recommended Cloudflare WAF Rule Configuration

Rule 1: Allow Verified Search Engines

Ensure legitimate discovery crawlers (Googlebot, Bingbot, DuckDuckBot) pass through without challenge:

configuration / code
Expression:
cf.bot_management.verified_bot eq true

Action:
Skip (Remaining WAF Rules)

Rule 2: Block Known AI Training Crawlers

Create a custom WAF expression to block identified foundational model training bots:

configuration / code
Expression:
(
  http.user_agent contains "GPTBot" or
  http.user_agent contains "ClaudeBot" or
  http.user_agent contains "Bytespider" or
  http.user_agent contains "CCBot" or
  http.user_agent contains "Amazonbot" or
  http.user_agent contains "Diffbot"
) and not cf.bot_management.verified_bot

Action:
Block (HTTP 403)

Rule 3: Permit AI Search Bots with Rate Limiting

If your strategy embraces AI citations (GEO), explicitly allow live answer crawlers:

configuration / code
Expression:
(
  http.user_agent contains "OAI-SearchBot" or
  http.user_agent contains "PerplexityBot"
) and not ip.src.asnum in {14061 16509} # Filter unverified cloud ASN hosting

Action:
Allow (or Managed Challenge if score is suspicious)

Cloudflare's Native "Block AI Scrapers" Toggle

Cloudflare provides a one-click toggle under Security → Bots → AI Scrapers and Crawlers.

[!WARNING] While convenient, the universal one-click toggle blocks all AI crawlers categorically—including those that feed citations into Perplexity, SearchGPT, and conversational engines. For organizations seeking brand visibility in AI answers, use Custom WAF Rules to distinguish training bots from search citation bots.


Verify that your Cloudflare firewall is not accidentally blocking valuable AI search traffic. Audit your setup with Geolify.ai.

Related policies