Block Country


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.

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


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

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?

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

Do I’m missing something here?

@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.

@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

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.

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

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