Country Rate Limting

Hello Community

I have been searching via docs and I was unable to conclude how I could setup rate limiting for my 'domain" for a certain country (only)

I was hoping if this was possible someone could point it out

Rate limiting is per IP, as far as I know there is no way to do that at the country level, excluding custom solutions implemented over Workers.

There is also very little need to rate limit a country, either challenge it or rate limit the normal way.


Hi there

I actually do I have a very specifc use case for rate limiting a certain country.(Only) I am very suprised Cloudflare do not have this as an option

I am getting smashed by China with some kind of very well written bot that cloudfare and my local firewall do not filter. This is coming up in my local firewall but not seen in Cloudflare (blocked analytics)

I have already blocked hudrends of IPs whole subnets but new IPs and new subnets just keep flooding in by the bucket load. Id have to say ive blocked over 1000 ips server side.

This is why I want to create a seperate country rate limiting rule for “China Only” Has Cloudflare maybe just not thought of such a function and a use case? Or, from a tech perspective its not possible to provide the function?

I am hoping C/F may consider adopting and deploying such a granular rule. They seem to have basically thought of everything else.

Also, basically from what I can see in the image below the rate limiting only gives me control over a single IP.

This is not good for me as this well written bot that is getting passed everything is coming from hundrends or thousand of different IPs.and skipping over my whole website looking for something. So in this case, I cannot find any single rule or protection on Cloudflare to mitigate this unknown traffic

Personally, to me it looks like I am getting attacked by some kind of huge botnet in china.

You can actually use Country as the rate limit criteria, only if you are using Enterprise plan and you subscribed to their Advanced Rate Limiting.


Thanks for this. However, It does not give me that option, It remaiins greyed out and stuck on IP only. I cannot change it

Oh I see. I only have a pro plan. So I need to foot the big cost just so I can rate limit a country because Cloudflare simply wont automatically protect me from this bombardment as it should (but cant work out this is an attack in my property.

Great! So all I am left with now is putting a managed challange for my whole website for a massive country. Less than ideal

Yeah, unfortunately this is the best thing you can do,

But I can understand why Cloudflare only provides rate limit based on other criteria (such as Country) to Enterprise plan with Advanced Rate Limiting is because this type of calculation is computationally expensive compared to just based on IP address.

1 Like

Maybe provide an addon option instead of need to pay the big ticket price of an enterprise plan?