I'm trying to use Nginx Location to block requests similar to this, which are causing load issues with WordPress (and the multilingual WPML plugin):
GET /foo/bar/?s=/?s=/?s=/?s=/?s=/?s=/?s=/?s=/?s=/?s=/ HTTP/1.1
However simplifying it to the following doesn't match:
location ~* \?s= {
return 404;
}
even though I've:
- placed it above all other location directives
- escaped the
?, but not the=(have tried that too) - removed
^and$to avoid slashes creating any confusion - used
~*for case-insensitive
(I can confirm that location foobar will correctly match "foobar" anywhere in the URL.)