<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><span style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;">I am trying to
          weed out requests for any uri that contains the string,
          "announce" (no quotes). That would include</span></span></p>
    <ul>
      <li><span style="font-family:monospace"><span
            style="color:#000000;background-color:#ffffff;">/announce</span></span></li>
      <li><span style="font-family:monospace"><span
            style="color:#000000;background-color:#ffffff;">/announce/</span></span></li>
      <li><span style="font-family:monospace"><span
            style="color:#000000;background-color:#ffffff;">/announce.php</span></span></li>
    </ul>
    <p>each with or without query strings. I have the following location
      blocks in my server context:<br>
    </p>
    <p><span style="font-family:monospace"></span></p>
    <span style="font-family:monospace"><span
        style="color:#000000;background-color:#ffffff;">        location
        ~* announce {
      </span><br>
                     return 444;
      <br>
             }<br>
    </span><br>
    <span style="font-family:monospace"><span
        style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;">
                 location ~* /announce.php {
        </span><br>
                       return 444;
        <br>
               }<br>
        <br>
      </span></span>
    <p>and my log looks good:<br>
    </p>
    <span style="font-family:monospace"><span
        style="font-family:monospace"></span></span>
    <p><span style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;"><span
            style="font-family:monospace"><span
              style="color:#000000;background-color:#ffffff;">"122.100.172.162"
                    "03/Aug/2022:20:19:00 -0400"    "GET
/announce.php?info_hash=%DF%AEF%40%7F%1DA%C9%91S%9F%D4%0D%D6J%E6%992%A3~&peer_id=-BC0171-_sSI%D1n%AA%A9%C3%A5%25%1E&port=153</span>02&natmapped=1&localip=172.18.80.247&port_type=lan&uploaded=46317568&downloaded=11285925264&left=178446055&numwant=50&compact=1&no_peer_id=1&key=38892
            HTTP/1.1"        "444"   "0"     "0.000"  "-"
                "BitComet/1.71.9.7"<br>
          </span></span></span></p>
    <p><br>
    </p>
    <p>until it doesn't:<br>
      <span style="font-family:monospace"></span></p>
    <p><span style="font-family:monospace">"81.110.165.170"
               "03/Aug/2022:20:24:03 -0400"    "GET
/announce.php?info_hash=%5B%EA0r%8A*8%C4%DAA%81%02%B4%BF%97%CC%1E%A9y%C8&am_peer_id=-TR300%5A-LDXTt3fAIyq%00&port=43342&uploaded=0&downloaded=0&left=5593535899&event=started&key=0&compact=1&numwant=200
        HTTP/1.1" "400"   "150"   "0.000" "-"     "-"<br>
      </span></p>
    <p><span style="font-family:monospace"><br>
      </span></p>
    <p><span style="font-family:monospace">I have tried various location
        prefixes and regexes (and combinations thereof) but can't seem
        to find the one that works correctly.</span></p>
    <p><span style="font-family:monospace">Thanks for any help<br>
      </span></p>
  </body>
</html>