How to Block a Country in Cloudflare Easily 2026
By Impran M N
If you're seeing abuse or spam traffic concentrated from certain regions, Cloudflare's WAF lets you filter it out by country. This guide covers building a geo-location firewall rule and choosing the right mitigation action for your situation.
01Open the WAF section
Select your domain, go to the Security directory, and click into WAF.
02Create a new rule
Select Custom Rules and click 'Create rule' to open the expression builder.
03Set the field to Country
Name your rule and use the Field dropdown to select the 'Country' selector.
04Choose your target countries
Pick an operator like 'equals' or 'in' and check the boxes for the specific countries you want to restrict.
05Choose your action and deploy
Set the action to Block, Managed Challenge, or a rate-limiting rule depending on how strict you want the restriction, then deploy and monitor the security events log.
Frequently asked questions
Should I always use a hard Block instead of a Challenge?
A hard Block denies access entirely, while a Managed Challenge lets legitimate visitors through after passing a verification step; the right choice depends on whether you want to fully exclude a region or just filter out bots.
Can I block multiple countries in one rule?
Yes, using the 'in' operator lets you check boxes for several countries within a single custom rule.
Will blocking a country affect search engine crawlers based there?
It can, since geo-blocking rules apply to all traffic from that country unless you add exceptions, so consider allowing known crawler IP ranges if that's a concern.
How do I check if the rule is actually blocking traffic?
Review your Security Events log after deploying the rule to see live traffic being matched and blocked by your country filter.
Watch the full walkthrough
The same steps, demonstrated on screen from start to finish.



