Block AI Crawlers with Cloudflare: WAF Rules That Actually Hold
Cloudflare can block AI crawlers at the edge, before robots.txt is even consulted, which is the only enforcement that holds against crawlers reported to ignore robots.txt. The two mechanisms are managed AI scraper blocking in the Cloudflare dashboard and custom WAF rules that match user-agent or autonomous system number. robots.txt remains the right tool for well-behaved crawlers, and edge blocking is the right tool for the rest.
The 4 Cloudflare AI Crawler Controls Compared
Cloudflare gives a zone 4 separate controls over AI crawler traffic, and they do different things: two of them modify the robots.txt your zone serves, two of them modify HTTP responses at the edge. The table below maps each control to its dashboard location, what it actually modifies, and which class of bot it affects:
| Control | Dashboard Location | What It Modifies | Which Bots It Affects |
|---|---|---|---|
| 1. Instruct AI bot traffic with robots.txt (managed robots.txt) | AI Audit (AI Crawl Control) panel | The robots.txt your zone serves: Cloudflare prepends a managed block with Content-Signal and Disallow lines above your own file | Training crawlers and AI search indexers that read robots.txt |
| 2. Block AI Bots toggle (Scrapers and Bots, WAF managed rule) | Security > Bots | HTTP response at the edge: reported AI scrapers get a 403 before robots.txt is consulted | Known AI training scrapers and aggressive bots |
| 3. Super Bot Fight Mode | Security > Bots (paid plans) | Allow, challenge, or block rules for Definitely Automated versus Verified Bots | All automated traffic, including AI agents and generic scrapers |
| 4. Custom WAF rules | Security > WAF > Custom rules | Block, JS Challenge, or Managed Challenge matched on http.user_agent or ip.src.asnum | Any token or ASN you name, such as GPTBot by token or Bytespider by ASN |
The key distinction: controls 1 and 4-adjacent robots.txt logic only request behavior from crawlers that honor the file, while controls 2, 3, and 4 enforce it in HTTP. Each of the bot classes in the AI crawlers list behaves differently on this line, which is why the per-token decisions belong in a plan rather than a toggle: the how to block AI crawlers guide and the how to allow AI crawlers guide cover those decisions, and the case study below shows what happens when the two layers disagree.
Case Study: How Cloudflare's Managed robots.txt Silently Contradicted Our Own Allow Rules
This happened on promptdns.com in November 2026, during a review of our own zone. Our authored robots.txt explicitly allows the major AI crawlers - we are a tool site about crawler access, so allowing them is our published policy. But the zone also had the AI Audit feature's Instruct AI bot traffic with robots.txt toggle enabled, which prepends a managed block above your authored file. The served robots.txt therefore began like this:
# BEGIN Cloudflare Managed content
Content-Signal: search=yes,ai-train=no,use=reference
User-agent: GPTBot
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: CCBot
Disallow: /
User-agent: Applebot-Extended
Disallow: /
# ... the managed block carried 25 Disallow: / lines in total ...
# END Cloudflare Managed content
# --- our authored file, served underneath the managed block ---
User-agent: GPTBot
Allow: /
User-agent: Google-Extended
Allow: /
Read as one document, the file told GPTBot to disallow everything in its managed preamble and then allow everything in our section - a direct contradiction that crawlers resolve unpredictably. Worse, the managed block was served conditionally: a request with a crawler user agent (we verified with GoogleOther) received the managed content, while a desktop browser user agent saw only our clean authored file. Every desktop check looked fine, and every real crawler read a policy we never wrote.
The fix was to disable the managed robots.txt injection and publish our own policy with the two AI bot classes separated - AI search indexers (OAI-SearchBot, ChatGPT-User, Claude-SearchBot, PerplexityBot) and training scrapers (GPTBot, ClaudeBot, CCBot) each get explicit, unambiguous sections. The served file now reads:
# AI crawlers and agents are explicitly welcome.
User-agent: OAI-SearchBot
Allow: /
User-agent: ChatGPT-User
Allow: /
User-agent: Claude-SearchBot
Allow: /
User-agent: PerplexityBot
Allow: /
# Training crawlers: our published policy is to allow, stated once per token.
User-agent: GPTBot
Allow: /
User-agent: ClaudeBot
Allow: /
User-agent: CCBot
Allow: /
Sitemap: https://promptdns.com/sitemap-index.xml After the fix, both layers agree: the served robots.txt matches our intent, and live HTTP probes with each crawler user agent return the same 200 OK that a desktop browser sees. We keep the Worker serving our exact file to every user agent, and we validate the served policy with the robots.txt checker and the per-bot verdicts in the AI crawler checker. The mechanics of the file itself - user-agent groups, longest-match, the wildcard rules - are covered in the robots.txt guide.
The Cloudflare Dashboard Steps, in Order
- Open AI Audit (AI Crawl Control) and read which AI bots actually hit your zone and how often. Decide policy per class before touching any toggle: AI search indexers usually deserve access because they drive citations, while training scrapers are a business decision.
- If you maintain your own robots.txt, disable Instruct AI bot traffic with robots.txt in the AI Audit panel so Cloudflare stops prepending the managed block. If you do not maintain a robots.txt at all, this same toggle is the fastest way to publish one - just read what it writes.
- For crawlers that ignore robots.txt, enable enforcement at the edge: turn on the AI scraper blocking toggle under Security > Bots, or add a custom WAF rule under Security > WAF > Custom rules matching
http.user_agent contains "GPTBot"(or ASN-levelip.src.asnum) with action Block. - Scope every rule to AI tokens and ASNs, never to all bot traffic, so Googlebot, Bingbot, and verified search crawlers keep their access.
- Verify with the curl commands below after every change, and keep the robots.txt and the edge behavior telling the same story.
# What a training crawler reads as policy:
curl -A "GPTBot/1.0" https://example.com/robots.txt
# What a training crawler receives at the edge (200 = allowed, 403 = blocked):
curl -I -A "GPTBot/1.0" https://example.com/
# Compare with a desktop user agent to catch conditional serving:
curl -I https://example.com/ This page is the enforcement layer of the wider AI Crawler Access guide, which connects robots.txt policy, llms.txt context, and verification into one stack.
Frequently Asked Questions
Does Cloudflare block AI crawlers by default?+
No, every AI-specific control is opt-in per zone: the managed robots.txt feature, the AI scraper blocking toggle, and custom WAF rules all stay inactive until you enable them.
Can Cloudflare managed robots.txt contradict my own robots.txt?+
Yes, while the Instruct AI bot traffic with robots.txt toggle is enabled, Cloudflare prepends a managed block above your authored file, and that block can allow or disallow bots differently from your own rules until you disable the injection.
Is the managed robots.txt served identically to every client?+
No, we observed conditional serving on our own zone: a crawler user agent received the managed block while a desktop browser user agent saw only our authored file, which is why verification must always use a crawler user agent.
Can I block AI crawlers on the Cloudflare free plan?+
Yes, the managed robots.txt feature and basic custom WAF rules are available on free plans; Super Bot Fight Mode requires a paid plan, and advanced rate limiting depends on your tier.
Will WAF rules that block AI bots affect Googlebot?+
No, not when scoped correctly: match AI crawler tokens such as GPTBot and ClaudeBot or their ASNs, never all bot traffic, and Googlebot continues to crawl normally.
Last verified: 2026-11-21