Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Whitelist request throttling in Nginx?
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 = ) {
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
You can’t perform that action at this time.