Description
As a DeFi protocol launching on Mainnet, we must be careful about regulatory compliance. Certain jurisdictions (like OFAC-sanctioned countries) cannot be allowed to access our frontend API.
We need to implement a geoblocking middleware that reads the incoming request's IP address, checks it against a GeoIP database, and blocks access if they are from a restricted region.
This protects the core team from legal liability during the Wave 3 launch.
Requirements
Description
As a DeFi protocol launching on Mainnet, we must be careful about regulatory compliance. Certain jurisdictions (like OFAC-sanctioned countries) cannot be allowed to access our frontend API.
We need to implement a geoblocking middleware that reads the incoming request's IP address, checks it against a GeoIP database, and blocks access if they are from a restricted region.
This protects the core team from legal liability during the Wave 3 launch.
Requirements
geoip-litenpm package.restrictedRegions.jsarray containing standard ISO country codes to block (e.g.,['KP', 'IR', 'SY']).req.ip(orreq.headers['x-forwarded-for']if behind a proxy) and looks up the country.451 Unavailable For Legal ReasonsHTTP status code.