Web Server
Caddy Blocklist Tutorial
Block VPN and proxy IPs in Caddy using remote_ip request matchers loaded from a TXT blocklist file at startup or via the file_server module.
Steps
- 1
Download the blocklist
Fetch the TXT blocklist from your AntiProxies dashboard. Caddy's remote_ip matcher accepts IPs and CIDR ranges directly.
- 2
Build the Caddyfile snippet
Use a script to inline the IPs into a remote_ip matcher or generate a Caddy JSON config fragment.
- 3
Include snippet in Caddyfile
Use the import directive to pull in the generated snippet from a separate file and keep your main Caddyfile clean.
- 4
Reload Caddy
Run caddy reload --config /etc/caddy/Caddyfile to apply the new config without restarting the process.
Need the blocklist files?
The annual license includes every format and monthly data releases.
Get the complete lists Inspect sample dataCaddyfile – import blocklist snippet
Use the import directive to load the generated blocklist snippet.
example.com {
# Import the AntiProxies blocklist snippet
import /etc/caddy/blocklists/antiproxies.caddy
reverse_proxy localhost:3000
} Generated blocklist snippet
Blocklist snippet – list all IPs space-separated after remote_ip. Reload Caddy after editing.
@blocked_ips remote_ip 1.2.3.4 5.6.7.0/24 10.0.0.1 192.168.100.0/22
respond @blocked_ips "Access denied" 403 Frequently asked questions
Is there a limit to how many IPs remote_ip can handle?
Does Caddy support CIDR ranges in remote_ip?
How do I handle X-Forwarded-For with Caddy?
Put the full dataset in your stack
€99/year gets you all 22 data categories, unlimited local queries, and one year of updates. Load the files once, keep your decision logic in-house, and update on your own deployment schedule.