Blocking Malicious Bots
Web scrapers, aggressive AI crawlers, and malicious bots consume bandwidth, steal content, and slow down your origin.
Basic Rules
Section titled “Basic Rules”# Block all requests with a high bot scoreIF waf.bot_score ge 80THEN block
# CAPTCHA for medium bot scoreIF waf.bot_score ge 60THEN captcha
# Allow search/SEO bots, block all other botsIF waf.client.bot == onAND waf.client.bot_category not_in search, seo, monitoringTHEN blockWith these selections in the console:
- Block high bot score — Field Bot Score (0–100) · Operator greater or equal · Value
80→ Action Block - CAPTCHA for medium bot score — Field Bot Score (0–100) · Operator greater or equal · Value
60→ Action CAPTCHA - Block other bots — Field Known Bot · Operator equals · Value Yes AND Field Bot Category · Operator not in list · Value
search, seo, monitoring→ Action Block
waf.bot_score returns a confidence score from 0 to 100 for each request; the closer to 100, the more certain the bot detection. Blocking requests at 80 and above keeps the risk of false positives on real users to a minimum.
For mid-range scores (60–79), prefer CAPTCHA. Some automation tools leave weak signatures; CAPTCHA validates traffic in this grey area without blocking legitimate users.
The waf.client.bot_category not_in search, seo, monitoring rule explicitly excludes known search engine crawlers and monitoring services from blocking. This ensures your site’s indexing and uptime tracking are not disrupted.
Advanced Variant
Section titled “Advanced Variant”# Block AI crawlers on /api paths but allow on other pathsIF waf.client.bot_category == ai_crawlerAND http.request.base_uri has_prefix /apiTHEN block
# Redirect non-bot requests from hosting IPs to CAPTCHAIF waf.client.ip_type == hostingAND waf.client.bot == offAND waf.bot_score ge 40THEN captchaWith these selections in the console:
- Block AI crawlers on the API — Field Bot Category · Operator equals · Value
ai_crawlerAND Field Path (without query) · Operator starts with · Value/api→ Action Block - CAPTCHA for suspicious hosting traffic — Field IP Infrastructure Type · Operator equals · Value
hostingAND Field Known Bot · Operator equals · Value No AND Field Bot Score (0–100) · Operator greater or equal · Value40→ Action CAPTCHA
AI crawlers often target API endpoints to harvest raw data. This rule blocks AI-class bots only under the /api prefix, while continuing to allow the same category of bots on static content or blog pages.
The second rule catches traffic from data center or cloud hosting IPs that carries no explicit bot signature but appears moderately suspicious. A real user can still solve the CAPTCHA; automated tools generally cannot.
- Always allow legitimate bots with
waf.client.bot_category in search, seoto protect your search ranking - Test with
logaction first, then switch toblockafter observing thresholds - You can allowlist Googlebot by name:
waf.client.bot_name == googlebot → allow