• Internet traffic from Ukraine, Russia, and China has been null-routed to a 403 error page.

    It's annoyingly effective, I couldn't even bypass it with a VPN so that made testing it difficult.

  • CloudFlare Geo-IP, which uses Maxmind data.

    Then the following nginx config:

    This outside of the server block:

    map $http_cf_ipcountry $allow_country {
        default yes;
        CN no;
        UA no;
    }
    
    map $host $test_country {
        default: no;
        http://www.lfgss.com yes;
    }
    

    This inside the virtual server block:

      if ($test_country = yes) {
        set $block Y;
      }
      if ($allow_country = no) {
        set $block "${block}Y";
      }
      if ($block = YY) {
        return 403;
      }
    

    The horrid thing there is that nginx does not allow nested IF statements, or multiple conditions... so instead I use single conditions to concat a string and test for the fully constructed string and then return 403.

About

Avatar for salmonchild @salmonchild started