Firewall rule to block traffic from specific countries is not working

Hi All,

Put in a firewall rule to block all traffic from few countries but I am still getting traffic from countries that are supposed to be blocked.

Any suggestions please?

Hi @dharma.vidyayug,

Without more information, it’s not possible to say much, however have you configured your server to only allow connections from Cloudflare IPs? If not, they may be bypassing Cloudflare and hitting your server directly.

1 Like

Hi domjh,

I havent configured my server to allow traffic from Cloudflare IP’s. Can you please tell me how to do so with free plan.

You would need to do this on your sever and not through Cloudflare. Have you checked that is the case and that they are bypassing Cloudflare, in your server logs?

If your server/host can’t do this, there are alternatives, but which are not as effective, like:


This could get expensive though, depending on how many requests your site gets.

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.

Hi, can anyone suggest what is the best practice to block the incoming traffic countrywise to my website in free plan. What kind on firewall rulesets i need to implement in free plan.

Thanks

Hi, can anyone help me out with blocking traffic countrywise in free plan because even if we apply firewall ruleset still getting traffic from those countries. So, how can i block the traffic to my website from few countries.

Thanks

Cloudflare Firewall Rules offer power and flexibility by targeting HTTP traffic and applying custom criteria to block, challenge, log, or allow certain requests.

In essence, firewall rules allow you to examine all incoming site traffic. Requests matching the criteria you defined are subject to a specific action in response.

You can manage your firewall rules via the:

  • Firewall Rules UI ( Firewall Rules tab under the Firewall app in the Cloudflare dashboard), and
  • APIs for Firewall Rules and Cloudflare Filters.

To get started, consult the following resources:

There are settings in the firewall rules that include countries & continents. Choose which region which you want to target & choose Block if it’s not your region.

1 Like

Also if you are blocking some countries/regions but still see this traffic then two things to note:

  • Make sure there isn’t an ALLOW rule before the country blocking
  • Make sure to change your webserver to only accept incoming requests from Cloudflare IP addresses as per this list IP Ranges | Cloudflare