
Cloudflare Security Art
Zero-trust Cloudflare WAF rules for small websites
Replaces —

Who it's for
The project is explicitly written for artists and creators who want to prevent AI companies from scraping their work. Part 2 targets the AI crawlers most likely to ingest creative content without attribution.
A blogger on a shared host who already uses Cloudflare's free plan can add these rules to cut bot traffic before it hits their origin, reducing bandwidth and exposure to credential-stuffing probes.
You need to allow programmatic access to your site via curl or Python-based tools from public IPs.
A developer deploying a small side project can use the security headers step to pass a securityheaders.com audit and the exploit-blocking rules in Parts 3 and 4 to deflect automated vulnerability scans.
Your project exposes a public API on the root domain rather than an api. subdomain, as the HTTP client block rules would interfere.
The problem
Small websites on Cloudflare's free plan lack a ready-made ruleset to block AI content scrapers, headless browser bots, and common exploit probes without accidentally blocking legitimate search engine crawlers or breaking their own site.
How it works
Part 1 of the WAF rules denies all crawlers by default and explicitly permits only verified bots in the Search Engine Crawler, Page Preview, and Security categories whose user agents match an allowlist (Googlebot, Bingbot, DuckDuckBot, and others). The README describes this as stopping approximately 90% of all threats before requests reach the application.
Part 2 blocks named AI bots by user-agent string, including GPTBot, ClaudeBot, Bytespider, Perplexitybot, MistralAI, CCBot, and Anthropic crawlers, as well as any Cloudflare-verified bot in the AI Crawler or Other categories.
Parts 3 and 4 block requests to paths like `/.env`, `/phpmyadmin`, `/backup`, `docker-compose`, `id_rsa`, and `authorized_keys`, query strings with path traversal sequences (`../`, `..%2f`), SQL injection fragments (`benchmark(`, `MD5(`), and tools like curl, wget, and python-requests (with exceptions for API and CDN subdomains).
Step 2 adds a Cloudflare DDoS L7 override set to block at default sensitivity and a rate-limiting rule that caps homepage requests at 2 per 10 seconds, targeting the HTTP/2 Rapid Reset attack (CVE-2023-44487).
Step 4 adds seven HTTP headers via Cloudflare Transform Rules: `strict-transport-security` with `includeSubDomains; preload`, `content-security-policy` with `upgrade-insecure-requests; block-all-mixed-content`, `permissions-policy` disabling camera and geolocation, `x-xss-protection`, `referrer-policy`, `cross-origin-opener-policy`, and `cross-origin-resource-policy`.
Features
- Zero-trust bot blocking
- AI crawler blocklist
- Exploit and sensitive-path blocking
- DDoS L7 rate limiting
- Security response headers
Recommended for this setup
Strengths
- Free-plan only: Every rule in the guide runs on Cloudflare's free tier. No paid WAF managed rulesets, no Workers, and no Bot Management subscription are required.
- Copy-paste expressions: Each WAF rule is a complete Cloudflare expression ready to paste into the dashboard. The guide includes the exact navigation path (Security > WAF > Custom rules > Create rule) so no prior Cloudflare WAF experience is needed.
- Allowlist-first to avoid false positives: Rather than blocking known bad actors alone, the zero-trust approach permits only an explicit set of verified bots and blocks everything else. The rule is described as tested to not break the site while still allowing Let's Encrypt ACME challenges and PKI validation paths.
Trade-offs
- Broad geographic and VPN blocking: Part 5 applies a Managed Challenge to traffic from most continents (NA, SA, OC, AF, AS) and a long list of European countries, as well as specific ASNs associated with VPN providers. Legitimate visitors using VPNs or traveling from those regions will see a Cloudflare challenge.
- Blocks developer HTTP clients site-wide: Part 4 blocks user agents containing curl, wget, python-requests, and okhttp on all hosts except those prefixed with `api.` or `cdn.`. Sites that expose public APIs on their root domain would need to modify the host exception list.
- Manual dashboard setup: The rules are pasted individually into the Cloudflare dashboard. There is no Terraform provider config, no Cloudflare API script, and no automated deployment path included in the repository.
Tech stack
FAQ
No. The README explicitly targets Cloudflare's free plan and all five WAF rule parts, the DDoS L7 override, the bot management settings, and the Transform Rules for security headers are available on it.
The guide recommends disabling Bot Fight Mode because the WAF rules in Part 1 already handle bot filtering with a more precise allowlist. Bot Fight Mode can challenge verified bots like Googlebot that the WAF rules are configured to pass, so the two mechanisms conflict.
Part 4 exempts hosts prefixed with `api.` and `cdn.`. If your scripts call the root domain, you would need to add an additional host exception or a WAF skip rule scoped to your known IP address.
Part 5 applies a Managed Challenge, not a block, to those regions. Visitors who pass the challenge reach the site normally. The rule targets high-bot ASNs and continents where the author observed elevated bot activity.
The README points to securityheaders.com to check the result after adding the Transform Rule. The guide lists the seven header names and their exact values to set in the Cloudflare dashboard.