JHM16
JHM16

Reputation: 798

How to block api access from certain country or region?

i am searching for best solution to restrict user access to my API . i want restrict users to get access to my API .

Upvotes: 1

Views: 1758

Answers (1)

Mohit Gupta
Mohit Gupta

Reputation: 378

There are 2 things, which you can do is.

  1. Write your own code, block the user based on certain factors for the country. Example - Use IP location,location,timezone,navigator.language,Accept-Language etc. From all this factors one can filter out the request coming from the country. It might not be efficient in some cases.

  2. Use cdn providers like cloudflare, in which you can block the access from several countries and everything handled by them.

Upvotes: 2

Related Questions