Created
May 30, 2014 23:15
-
-
Save supairish/748c85552b2f7047a36a to your computer and use it in GitHub Desktop.
Whitelist request throttling in Nginx?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
map $whitelist $limit { | |
default $binary_remote_addr; | |
1 ""; | |
} | |
limit_conn_zone $limit zone=conn_limit_per_ip:10m; | |
limit_req_zone $limit zone=req_limit_per_ip:10m rate=5r/s; | |
server { | |
set $whitelist ""; | |
if ( $hostname = some_url.com ) { | |
set $whitelist 1; | |
} | |
limit_conn conn_limit_per_ip 10; | |
limit_req zone=req_limit_per_ip burst=30 nodelay; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment