I'm getting some kind of access that is causing problems on my server:
172.68.28.210 - - [03/Jul/2016:13:41:06 -0300] " "GET / HTTP/1.1" 502 166 "-" "-"
I would like to block even the $HTTP_USER_AGENT, made this attempt did not work.
if ($http_user_agent = "-") {
return 403;
}
Someone would know what's wrong?
That is because the
$http_user_agentvariable may have different value depending on the context.If the header is absent in the request, then it'll present itself as
-in youraccess_log, all the while still being just empty within your if-statement.Thus, perhaps the following is what you want instead: