カスタム URL (クエリ文字列) の IP のアクセスをブロックします

カスタム URL (クエリ文字列) の IP のアクセスをブロックします

nginx 1.19.9

このようなURLがあります

  • https://example.com/test?mindbox-message-key=...
  • https://example.com/men?mindbox-message-key=...
  • https://example.com/women?mindbox-message-key=...
  • https://example.com/chile?mindbox-message-key=...

いくつかの IP をブロックする必要があります。どうすればいいでしょうか?

答え1

server {
    ...

    location /my-custom-url {
        if ($args ~* "mindbox-message-key") {
            deny all;
        }
    }

    ...
}


関連情報