Block Country


#1

Hello,

Could you please point me to the right direction what plan need from Cloudflare in order to block a country?

Eg: I want to block all traffic from: IR (Country code)

Thank you very much for your answer.


#2

You can do this on the free plan. See Firewall -> Access Rules


#3

Hi,

@martin2 I have tried this in the past but not worked with the free plan.


#4

I have just tried this on a free plan, and can confirm it works. Are you sure Cloudflare filtered the traffic, and the record was :orange: orange clouded at the moment of test?


#5

Hm… strange, I just tried now and the message I got is below on screen.

Do I’m missing something here?


#6

@martin2 Are you sure it’s possible?

Unless this bug came back (or hasn’t been fixed yet), non-enterprise plans shouldn’t be able to block by country.

@kefallinou79 What you can try is setting up your web server to block based on the Cf-IPCountry header. Check if the value of this header is IR and return 403/401 if it’s a country you want blocked.

https://support.cloudflare.com/hc/en-us/articles/200168236-What-does-Cloudflare-IP-Geolocation-do-


#7

@Judge Thanks for checking this out deeper, I’m on the free plan so I guess that needs a paid to do so.
However, I can do it on server level with NGiNX and Geo-IP module.

Thanks in advance


#8

I am truly sorry for the misunderstanding.

It seems you are right, and I admit I only tried setting up a JavaScript challenge when testing.

My apologies. I am not able to create a block on country level either.


#9

Country blocks were available to all plans after they rolled out a new dashboard. It doesn’t work anymore.


#10

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