79130258

Date: 2024-10-27 09:28:28
Score: 0.5
Natty:
Report link

It can be done in nginx using geoip2 module.

this block goes to http { part of config, for example

/etc/nginx/conf.d/geoip.conf

geoip2 /usr/share/GeoIP/country_asn.mmdb {
     # if you have some database update script, you can configure auto reload
     # auto_reload 1h;
     $geoip2_asn asn;
     $geoip2_as_name as_name;
     $geoip2_continent continent;
     $geoip2_continent_name continent_name;
     $geoip2_country country;
}

And use it in location

put this in location

if ($geoip2_asn = "AS32934") {
    return 402;
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: iwik