How to Block a Specific Country in Cloudflare
Blocking a specific country from accessing your website in Cloudflare can help protect your site from unwanted traffic or prevent access from regions where you do not offer services. Follow these steps to set up a country-based block in Cloudflare:
Step 1: Log in to Your Cloudflare Account
Visit https://www.cloudflare.com/ and log in to your Cloudflare account.

Step 2: Select Your Website
From the Cloudflare dashboard, navigate to Your Sites and click on the domain you want to configure with country-blocking rules.
Step 3: Open the Security Tab
In your site’s dashboard, click on the Security tab at the top of the page. Here you’ll find options related to access and traffic management.

Step 4: Go to Custom Rules
Scroll down and select WAF from the left-side menu. Under Custom Rules, click on Create a Rule to begin setting up a country block.

Step 5: Configure the Country Blocking Rule
- Name Your Rule: Enter a name, like “Block Country Access,” to easily identify this rule later.
- Set the Field: Choose Country from the drop-down menu under “Field.”
- Operator: Select is in to specify the countries you want to block.
- Value: Enter the name of the country (or countries) you want to block. You can add multiple countries if necessary.
- Action: Choose Block as the action to prevent access from the selected countries.

Step 6: Save and Deploy the Rule
Click Deploy or Save at the bottom of the page to activate the rule. This will immediately block access to your website from the specified country (or countries).
Your site is now configured to block traffic from the selected country. This setting can be adjusted anytime by returning to the Custom Rules section in your Cloudflare dashboard.