-
-
Save arenadoon/820e70d8d2e6c90ea8263465e8d92e37 to your computer and use it in GitHub Desktop.
Whitelist request throttling in Nginx?
This file contains hidden or 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