English
This guide explains how to use Cloudflare to filter traffic from a specific country. This is useful for monitoring or blocking traffic from certain geographic regions.
Prerequisites
- Access to your Cloudflare account.
- A properly configured domain in Cloudflare.
Steps to filter traffic from a country
1. Log in to Cloudflare
- Go to Cloudflare Dashboard.
- Log in with your credentials.
- Select the domain you wish to configure.
2. Navigate to Firewall Rules
- In the side panel, click Security > WAF (Web Application Firewall).
- Select Firewall Rules.
3. Create a new rule
- Click Create a Firewall Rule.
- Assign a name to the rule, such as: Filter Country - Italy.
4. Configure rule criteria
- In the Field section, select Country.
- In the adjacent column, choose the operator:
- is: to include only traffic from the specified country.
- is not: to exclude traffic from the specified country.
- In the next field, select the desired country (e.g., Italy).
5. Set the action
Choose the desired action:
- Allow: Allows traffic only from the specified country.
- Block: Blocks all traffic from the specified country.
- Challenge (Captcha): Requires users to complete a CAPTCHA.
- JS Challenge: Verifies traffic with a JavaScript challenge.
6. Save and apply the rule
- Click Deploy to activate the rule.
- The rule will be immediately applied and visible in the Firewall Rules list.
Configuration example
Block traffic from Italy
- Field: Country
- Operator: is
- Value: Italy
- Action: Block
Monitoring and management
- Go to Security > Events to view events associated with the rule.
- Verify that the filter works as expected.
- Edit or disable the rule if necessary.
Additional notes
- Firewall rules do not affect internal Cloudflare traffic (e.g., API or administrators).
- Use rules cautiously to avoid blocking legitimate users.
If you need further assistance, contact Utixo technical support.