Block malicious traffic at the edge with the Web Application Firewall.
The WAF (Web Application Firewall) lets you control who can access your content by creating rules based on IP addresses, countries, or paths. Rules are evaluated at the edge, blocking threats before they reach your origin.
Block or allow specific IP addresses or CIDR ranges:
192.168.1.1 # Single IP
10.0.0.0/8 # CIDR range
203.0.113.0/24 # /24 subnet
Block or allow entire countries using ISO country codes:
CN # China
RU # Russia
US # United States
DE # Germany
Country detection uses MaxMind GeoIP2 database.
Immediately returns a 403 Forbidden response with a styled error page.
Best for:
Immediately allows the request, skipping all subsequent rules.
Best for:
Shows a proof-of-work challenge page. The visitor's browser must complete a computation before accessing the site.
Best for:
Rules are evaluated in priority order (lowest number = highest priority).
Priority 1: Allow office IP (192.168.1.100)
Priority 2: Block country (CN)
Priority 3: Challenge country (RU)
First matching rule wins. In the example above:
curl -X POST "https://nordiccdn.com/api/v1/zones/{uuid}/waf-rules" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Block bad IPs",
"priority": 100,
"target_type": "ip",
"ip_addresses": ["203.0.113.0/24", "198.51.100.1"],
"action": "block"
}'
Optionally restrict rules to specific paths:
/wp-admin/* # All admin paths
/api/* # All API paths
/downloads/* # Download section
^/wp-(admin|login).* # Admin and login
\.(php|asp)$ # PHP and ASP files
When using the Challenge action:
Controls how long the challenge takes:
| Difficulty | Approximate Time |
|---|---|
| 14 (Low) | < 1 second |
| 18 (Medium) | 2-3 seconds |
| 22 (High) | 5-10 seconds |
| 24 (Very High) | 10-30 seconds |
How long the challenge cookie is valid:
{
"name": "Block high-risk countries",
"priority": 100,
"target_type": "country",
"countries": ["CN", "RU", "KP", "IR"],
"action": "block"
}
{
"name": "Allow office",
"priority": 1,
"target_type": "ip",
"ip_addresses": ["203.0.113.10"],
"action": "allow"
}
{
"name": "Challenge admin access",
"priority": 50,
"target_type": "country",
"countries": ["*"],
"paths": ["/wp-admin/*", "/wp-login.php"],
"action": "challenge",
"challenge_mode": "interactive",
"challenge_difficulty": 18
}
[
{
"name": "Allow EU only",
"priority": 1,
"target_type": "country",
"countries": ["DE", "FR", "NL", "DK", "SE", "NO", "FI"],
"action": "allow"
},
{
"name": "Block everyone else",
"priority": 2,
"target_type": "ip",
"ip_addresses": ["0.0.0.0/0"],
"action": "block"
}
]
View rule performance in your dashboard:
Check access logs for blocked requests:
403 - Blocked by WAF rule "Block bad IPs"
Always create allow rules for trusted IPs before block rules.
For uncertain traffic, use challenges instead of blocks. This reduces false positives.
After creating rules, monitor:
Review and update rules periodically:
GeoIP databases occasionally have inaccuracies. Contact support if you notice consistent misdetection.