Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/bot-management/configuration.md
1# Bot Management Configuration23## Product Tiers45**Note:** Dashboard paths differ between old and new UI:6- **New:** Security > Settings > Filter "Bot traffic"7- **Old:** Security > Bots89Both UIs access same settings.1011### Bot Score Groupings (Pro/Business)1213Pro/Business users see bot score groupings instead of granular 1-99 scores:1415| Score | Grouping | Meaning |16|-------|----------|---------|17| 0 | Not computed | Bot Management didn't run |18| 1 | Automated | Definite bot (heuristic match) |19| 2-29 | Likely automated | Probably bot (ML detection) |20| 30-99 | Likely human | Probably human |21| N/A | Verified bot | Allowlisted good bot |2223Enterprise plans get granular 1-99 scores for custom thresholds.2425### Bot Fight Mode (Free)26- Auto-blocks definite bots (score=1), excludes verified bots by default27- JavaScript Detections always enabled, no configuration options2829### Super Bot Fight Mode (Pro/Business)30```txt31Dashboard: Security > Bots > Configure32- Definitely automated: Block/Challenge33- Likely automated: Challenge/Allow34- Verified bots: Allow (recommended)35- Static resource protection: ON (may block mail clients)36- JavaScript Detections: Optional37```3839### Bot Management for Enterprise40```txt41Dashboard: Security > Bots > Configure > Auto-updates: ON (recommended)4243# Template 1: Block definite bots44(cf.bot_management.score eq 1 and not cf.bot_management.verified_bot and not cf.bot_management.static_resource)45Action: Block4647# Template 2: Challenge likely bots48(cf.bot_management.score ge 2 and cf.bot_management.score le 29 and not cf.bot_management.verified_bot and not cf.bot_management.static_resource)49Action: Managed Challenge50```5152## JavaScript Detections Setup5354### Enable via Dashboard55```txt56Security > Bots > Configure Bot Management > JS Detections: ON5758Update CSP: script-src 'self' /cdn-cgi/challenge-platform/;59```6061### Manual JS Injection (API)62```html63<script>64function jsdOnload() {65window.cloudflare.jsd.executeOnce({ callback: function(result) { console.log('JSD:', result); } });66}67</script>68<script src="/cdn-cgi/challenge-platform/scripts/jsd/api.js?onload=jsdOnload" async></script>69```7071**Use API for**: Selective deployment on specific pages72**Don't combine**: Zone-wide toggle + manual injection7374### WAF Rules for JSD75```txt76# NEVER use on first page visit (needs HTML page first)77(not cf.bot_management.js_detection.passed and http.request.uri.path eq "/api/user/create" and http.request.method eq "POST" and not cf.bot_management.verified_bot)78Action: Managed Challenge (always use Managed Challenge, not Block)79```8081### Limitations82- First request won't have JSD data (needs HTML page first)83- Strips ETags from HTML responses84- Not supported with CSP via `<meta>` tags85- Websocket endpoints not supported86- Native mobile apps won't pass87- cf_clearance cookie: 15-minute lifespan, max 4096 bytes8889## __cf_bm Cookie9091Cloudflare sets `__cf_bm` cookie to smooth bot scores across user sessions:9293- **Purpose:** Reduces false positives from score volatility94- **Scope:** Per-domain, HTTP-only95- **Lifespan:** Session duration96- **Privacy:** No PII—only session classification97- **Automatic:** No configuration required9899Bot scores for repeat visitors consider session history via this cookie.100101## Static Resource Protection102103**File Extensions**: ico, jpg, png, jpeg, gif, css, js, tif, tiff, bmp, pict, webp, svg, svgz, class, jar, txt, csv, doc, docx, xls, xlsx, pdf, ps, pls, ppt, pptx, ttf, otf, woff, woff2, eot, eps, ejs, swf, torrent, midi, mid, m3u8, m4a, mp3, ogg, ts104**Plus**: `/.well-known/` path (all files)105106```txt107# Exclude static resources from bot rules108(cf.bot_management.score lt 30 and not cf.bot_management.static_resource)109```110111**WARNING**: May block mail clients fetching static images112113## JA3/JA4 Fingerprinting (Enterprise)114115```txt116# Block specific attack fingerprint117(cf.bot_management.ja3_hash eq "8b8e3d5e3e8b3d5e")118119# Allow mobile app by fingerprint120(cf.bot_management.ja4 eq "your_mobile_app_fingerprint")121```122123Only available for HTTPS/TLS traffic. Missing for Worker-routed traffic or HTTP requests.124125## Verified Bot Categories126127```txt128# Allow search engines only129(cf.verified_bot_category eq "Search Engine Crawler")130131# Block AI crawlers132(cf.verified_bot_category eq "AI Crawler")133Action: Block134135# Or use dashboard: Security > Settings > Bot Management > Block AI Bots136```137138| Category | String Value | Example |139|----------|--------------|---------|140| AI Crawler | `AI Crawler` | GPTBot, Claude-Web |141| AI Assistant | `AI Assistant` | Perplexity-User, DuckAssistBot |142| AI Search | `AI Search` | OAI-SearchBot |143| Accessibility | `Accessibility` | Accessible Web Bot |144| Academic Research | `Academic Research` | Library of Congress |145| Advertising & Marketing | `Advertising & Marketing` | Google Adsbot |146| Aggregator | `Aggregator` | Pinterest, Indeed |147| Archiver | `Archiver` | Internet Archive, CommonCrawl |148| Feed Fetcher | `Feed Fetcher` | RSS/Podcast updaters |149| Monitoring & Analytics | `Monitoring & Analytics` | Uptime monitors |150| Page Preview | `Page Preview` | Facebook/Slack link preview |151| SEO | `Search Engine Optimization` | Google Lighthouse |152| Security | `Security` | Vulnerability scanners |153| Social Media Marketing | `Social Media Marketing` | Brandwatch |154| Webhooks | `Webhooks` | Payment processors |155| Other | `Other` | Uncategorized bots |156157## Best Practices158159- **ML Auto-Updates**: Enable on Enterprise for latest models160- **Start with Managed Challenge**: Test before blocking161- **Always exclude verified bots**: Use `not cf.bot_management.verified_bot`162- **Exempt corporate proxies**: For B2B traffic via `cf.bot_management.corporate_proxy`163- **Use static resource exception**: Improves performance, reduces overhead164