Allow traffic from specific countries only
This example blocks requests based on country code using the ip.src.country
field, only allowing requests from two countries: United States and Mexico.
- Expression:
(not ip.src.country in {"US" "MX"})
- Action: Block
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark