Creating Firewall Rule for Regions (US States)

Is there a way to create a firewall rule that limits traffic to specific states in the US so as to focus traffic to local users (small for a small local business with no ecommerce). Also, is this a bad idea for some reason?

Currently using this rule (ip.geoip.country in {“US”})
How can I alter this?

Nope. Firewall Rules don’t go that deep. You’d have to write your own Worker to do this.
Personally, I think that’s going a bit too far in limiting your audience. There’s no real reason to “focus traffic”, as long as your server can handle the current load.

2 Likes

My tool of the month Transform Rule followed by a Firewall Rule would be easier.

In general, this is a bad idea and a poor user experience. As @sdayman said, an efficient website with a good caching policy should make the number and location of users irrelevant.

I can think of lots of reasons why blocking by country/region is bad, some of which depend on what your business is. The easiest one is that geo-IP data is not precise, and you might be fire-walling people by mistake. The less easy one is that if I’m travelling to <city> next week and need to find a <dentist, hardware store, toy shop, etc> when I get there, I’ll never visit those businesses who just had a big error message instead of a website. But there are plenty of other reasons.

Darn it. Foiled again!

1 Like