Skip to content

Instantly share code, notes, and snippets.

@laztname
Created March 20, 2023 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laztname/5cfa8e5a7072b9a3cf80282909a95bd9 to your computer and use it in GitHub Desktop.
Save laztname/5cfa8e5a7072b9a3cf80282909a95bd9 to your computer and use it in GitHub Desktop.
server {
## Block user agents
set $block_user_agents 0;
# Common bandwidth hoggers and hacking tools.
if ($http_user_agent ~ "libwww-perl") {
set $block_user_agents 1;
}
if ($http_user_agent ~ "Go-http-client") {
set $block_user_agents 1;
}
if ($http_user_agent ~ "python-requests") {
set $block_user_agents 1;
}
if ($http_user_agent ~ "masscan") {
set $block_user_agents 1;
}
if ($http_user_agent ~ "masscan") {
set $block_user_agents 1;
}
if ($block_user_agents = 1) {
return 403;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment