Block city

How i can block city from visiting my blog? Not country

If you have the Business Plan on the zone you’d protect, you could use a Worker script that checks the cf.city object which uses the MaxMind GeoIP data source for IP city geolocation. This data isn’t currently provided to lower tiered zones.

Otherwise, you could implement Maxmind’s GeoLite2 database yourself and block the city on your server/in your website’s code. https://dev.maxmind.com/geoip/geoip2/geolite2/ Further help with implementing this yourself is a outside the scope of this forum, Google and Stack Overflow would likely be better.

I wonder how close the following will get. I found these fields for Firewall Rules. I think the first one will get to state level in the US. Don’t know about the second one. Maybe county?

Huh, haven’t seen that. Got subdivision 1 blocking US-GA for Georgia:

(ip.geoip.subdivision_1_iso_code eq "US-GA" and http.request.uri.path eq "/blockga")

But I’m not sure if every city has a subdivision code for subdivision_2, I can’t get it working for my city.

2 Likes

Ok how i can block from list geography city here on cloudflare account

I just checked with Support. Cloudflare doesn’t have that fine-grained of control.

2 Likes

Hey I want to ban some cities from visiting my site, what is the way to do this if outside this community… please explain to me in detail ?

Please do not recreate a thread with the same subject matter. As said above, it’s not currently possible with just Cloudflare.

1 Like

Tell me then what is the site that offers such a service

Sorry but please use Google for that.

Cloudflare does not offer such a granular blocking at the moment. You are very welcome to file a feature request here:

https://community.cloudflare.com/c/feedback/prodreq

2 Likes