How do I know when the nginx variable $http_referer is not set or empty?
I receive some requests that don't have a http referer. In nginx logs $http_referer appears like that: "-". What I am trying to do is to "return 403;" if the $http_referer is not set or empty as in this case.
Thanks!
http://nginx.org/en/docs/http/ngx_http_referer_module.html#valid_referers
valid_referers server_names ~.;
if ($invalid_referer) {
return 403;
}