Cloudflare: How to Block Visitors from Russia and Belarus from Accessing Your Domain?

less than a minute of reading

If you manage your DNS records through Cloudflare, then controlling IP addresses of visitors from specific countries is just a matter of specifying WAF (Web Application Firewall) rules. Let me show you, how to completely ban specific countries from accessing your website. As a purely random example, we will pick Russia and Belarus as target countries.

Pick a Website

Assuming you are currently logged into your Cloudflare dashboard, from the main page, pick one of your active websites where you want to apply the country limitation.

Accessing Web Application Firewall

On the sidebar, go to Security - WAF and click on the Create firewall rule button.

Adding new Rule and Deployment

Fill all of the mandatory fields, give your new rule a name. In my example for tutorial purposes I have picked purely random name like Ban Reds to give it some meaning.

Now specify criteria for incomming requests:

  • for the Field select Country
  • for the Operator select is in (but if you have just a single target then you can also use equals)
  • for the Value, simply pick Russia Federation and Belarus

Finally define what should happen if an incomming request matches these criteria, in our case we simply want to block access. Save changes by clicking Deploy firewall rule.

The following screen shows your newly deployed rule.

This is everything. Obviously there are VPNs or similar services to bypass such a limitation, but this should be a nice starting point anyway. 


Words: 244
Published in: Cloudflare