How could I block all non-US IP addresses from access to my website?

前端 未结 2 1522
醉梦人生
醉梦人生 2021-01-03 00:59

I want to block all non-US users from accessing my website. I\'m using nginx on the front end and have a django powered website.

1) How can I determine what are U

2条回答
  •  情书的邮戳
    2021-01-03 01:33

    You need a GEO location provider.

    Some are free, some are online checks, some give you a list or a library.
    Generally the more accuracy you want the more you pay for it.

    There is a limit to how accurately you can do this. Some small countries traffic might be routed through the US or it's name servers hosted in the US. Generally you shouldn't get too many false negatives for US customers.

提交回复
热议问题