Skip to content

Instantly share code, notes, and snippets.

@kanibaspinar
Created June 15, 2016 18:07
Show Gist options
  • Save kanibaspinar/b22291585c506d44349ba822dfefdc5d to your computer and use it in GitHub Desktop.
Save kanibaspinar/b22291585c506d44349ba822dfefdc5d to your computer and use it in GitHub Desktop.
Prevention of new types of Http Get Flood attacks at Layer 7 with nginx
#
# Hello provide protection for these settings http get flood attacks.
# Please add this rule to the appropriate sections in your default.conf file.
# Please note that the server {} function does not take place in part become invalid
#
set $add 1;
set $ban '';
###### Rule 1 ########
if ($http_referer = '-' ) {
set $ban $ban$add;
}
if ($request_uri = '/') {
set $ban $ban$add;
}
if ($http_user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)') {
set $ban $ban$add;
}
if ($ban = 111) {
return 444;
}
#Have a nice day#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment