In nginx access.log I see many lines like:
1.2.3.4 - - [19/Oct/2014:22:48:11 -0400] "POST /someurl/suburl HTTP/1.1" 200 19967 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2"
Where only common thing between them is the "-" (which I assume means no referer is set).
So I tried to deny these requests using:
if ($http_referer ~ ^(-))
{ return 444;
}
However, as you see above, this does not work for POST requests.