I'm getting tens of thousands of (quite probably malicious) hits on Apache which are bringing the server down. All hits look like this on the Apache log:
[30/Jan/2022:21:57:41 +0000] "POST //xmlrpc.php HTTP/1.1" 200 630 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4240.193 Safari/537.36"
(Note the double slash. I don't know what it means.)
I have added the rule below on .htaccess to try to mitigate the server load:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} ^//xmlrpc.php
RewriteRule .* - [F,L]
</IfModule>
When I run curl -kIL -X POST -H 'Host: [REDACTED]' https://127.0.0.1:443/xmlrpc.php
, I get the 403 error code.
However, apparently it is not enough: according to the log, Apache keeps returning 200 for the requests with two slashes. How can I block these requests (return 403)? How can I use curl / wget / etc to check if the block is active?
I need a rule to prevent "POST //xmlrpc.php HTTP/1.1" from returning 200 (HTTP OK) and return 403 instead.