Blocking IP from canister

Hi devs!

I’m looking for some ways to block IP of people from a country. Have you get this kind of requirement? How you doing it from both frontend and backend canister

Hi,

Technically speaking, I don’t think it’s possible at this point to restrict countries on the backend side because the canister doesn’t receive country code or IP geolocation information (not sure of the exact technical terms here, but you know what I mean).

For the frontend, you can restrict countries using third-party services as for example those used in NNS dapp to restrict participation in SNS sales as defined by their parameters (see frontend fetch code here).

3 Likes