In the main server block (e.g. /etc/nginx/nginx.conf) add the following:
if ($http_user_agent ~* (AgentName) ) {
return 403;
}
Test nginx config and restart:
nginx -t
service nginx restart
To test the agent gets blocked:
curl -I -H 'User-agent: AgentName' localhost/bla
HTTP/1.1 403 Forbidden
Recent Comments