Skip to content

Comment on Ask HN: Would there be a way to limit a website to geographically local traffic?

Comments

This is seldom a good idea in my opinion, because the underlying problem is rarely a technology one; moreover you can never be absolutely sure that you are indeed blocking all traffic, stopping users that use VPNs for example is tough.

In case you have a legitimate application however, the fundamental way to do this would be to consult a database that maps ip ranges to ASs or country codes directly like this one: https://iptoasn.com/

Once you have the affected ip ranges you can block them either at level 3 in a router or at the application level.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.