Cloudflare WAF Integration
Block requests from ipinsights.io blocklisted IPs at Cloudflare's edge using a managed IP list and a single Custom WAF rule.
Overview
Cloudflare's IP Lists let you store up to 10,000 entries per list (Pro plan)
and reference them from a Custom WAF rule. We'll create the list, upload the
ipinsights.io blocklist via the API, and build a Custom Rule that blocks
any request where ip.src matches.
Prerequisites
- A Cloudflare account with at least a Pro plan (Custom Rules + IP Lists)
- A Cloudflare API token with the Account → Account Filter Lists → Edit permission
- Your Cloudflare account ID (Dashboard → right sidebar)
curlandjqon the host that will run the sync
Step 1 — Create the IP List
In the Cloudflare dashboard go to Manage Account → Configurations → Lists and click Create new list. Use:
Step 2 — Sync Script
Create /usr/local/bin/ipinsights-cf-sync.sh:
Run it once manually to populate the list, then schedule it hourly via cron or systemd.
Step 3 — Create the Custom Rule
Open Your Zone → Security → WAF → Custom rules and add:
Move the rule to the top of the list so it short-circuits before any allow rules. For lower
false-positive risk on a public site, use Managed Challenge instead of
Block.
Step 4 — Verify
- Open the list in the dashboard and confirm the item count.
- Open Security → Events and filter by your rule name to see live blocks.
- From a known-bad IP (use a Tor exit you just looked up on
our lookup tool) confirm a
403is returned.
Notes & Limits
- Plan limits: Pro → 10,000 items per list. Use the CIDR-aggregated feed
at
https://ipinsights.io/downloads/blocklist-cidr.txtif you hit the cap. - Cloudflare's API rate limit (1,200 / 5 min per token) is more than enough for hourly syncs.
- If you also use Cloudflare Workers, see the Workers integration for live, per-request enrichment.
API Key: No ipinsights.io API key is needed for the public blocklist. You only need an ipinsights.io key for the live lookup API used by the Workers integration.
Request Higher API Limit
Running a high-volume Cloudflare WAF deployment? If the default rate limit isn't enough for your environment, submit a request below and we'll review it.