How to block Country level bot traffic in Cloudflare? Stop bot traffic easily

How to block Country level bot traffic in Cloudflare? Cloudflare is a tool that helps protect your website and make it faster. It sits between your website and the people who visit it. This means when someone tries to open your site, the request goes through Cloudflare first. It checks if the visitor is safe or not.

Cloudflare also protects your site from bots, hackers and spam traffic. It blocks bad visitors and only allows real users. Along with security, it also helps your site load faster by saving copies of your pages at multiple server and showing them quickly to visitors.

How to Block Country Level Traffic in Cloudflare?

Sometimes, your website gets traffic from countries that you don’t want. This traffic may be from bots, hackers or unwanted visitors. It can slow down your website or affect your analytics.

If you’re using Cloudflare, you can easily block visitors from any country. You don’t need to be a technical expert. Just follow this easy step-by-step guide. Let’s learn how to block country-level traffic using Cloudflare.

Why block country-level traffic?

Why you need to block country-level traffic for your website? Sometimes it hurt your revenue but If you are in problem and bot traffic from specific country hurt your website than you must know How to block country level bot traffic in Cloudflare?

Here are a few common reasons for why block country-level bot traffic?

  • You don’t serve customers from that country.
  • Bots from that country are attacking your website.
  • You want to reduce fake traffic.
  • You want to protect your server and save bandwidth.
  • Blocking such traffic can help your website perform better and stay secure.

Read: Stop Wasting Time—Here’s the Best Blog Writing Tool in 2025

Steps to Block Country Traffic in Cloudflare

Step 1: Log in to Cloudflare

If you want to block country-level bot traffic in Cloudflare, first of all you need to login in your Cloudflare account. Go to https://dash.cloudflare.com and Log in with your email and password.

Step 2: Choose Your Website

After logging in, you will see a list of websites you connected with cloudflare. Simply click on the website where you want to block a country.

Step 3: Open the ‘Security’ Section

Now in step 3, on the left sidebar click on Security Tab. Then click on WAF (Web Application Firewall).

Step 4: Create a New Firewall Rule

Now scroll down to Firewall Rules. Click on Create a Firewall Rule and give your rule a name like: Block China Traffic. Now you will see an option to Edit Expression. Paste this code – (ip.geoip.country eq “CN”). This means block visitors from china. You can change "CN" to the country you want to block.

Step 5: Set the Action to ‘Block’

After setting the rule, look for the Action option and choose Block from the dropdown.

Step 6: Deploy the Rule

Click Deploy or Save after set the action. Your rule is now active. That’s it! If you want to block more country in in single rule only add the country code and it will work. You can use as this type – (ip.geoip.country in {“CN” “RU”}). This rule block visitor from Russia and China together.

Some Country Level Code in Cloudflare

  • CN = China
  • RU = Russia
  • IN = India
  • US = United States
  • PK = Pakistan

Tips & Warnings

  • Don’t block countries where your real users live.
  • If you’re unsure, you can use the “Challenge” option instead of full block.
  • Check your traffic regularly in Google Analytics or Cloudflare dashboard.

Final Words

Cloudflare makes it easy to protect your website from unwanted traffic. Blocking a country is just a few clicks away. If you’re getting fake visits, bot traffic or security issues from a specific country — use this feature and stay safe. This method is fast, simple and works for any website using Cloudflare.

Leave a Comment

19 − 15 =

Join WhatsAppJoin Telegram
ChannelChannel