Skip to content

Instantly share code, notes, and snippets.

@witscher
Created November 26, 2015 15:20
Show Gist options
  • Save witscher/1ed67e40472c87e8f711 to your computer and use it in GitHub Desktop.
Save witscher/1ed67e40472c87e8f711 to your computer and use it in GitHub Desktop.
# Request Limiter checking multiple values with small footprint
# if referer is not set
map $http_referer $limit_referer {
default "";
"" "1";
"-" "1";
}
# if custom parameter is not set. i.e. you always expect urls like "/tracker?campaignid=1234"
map $arg_campaignid $limit_campaignid {
default "";
"" "1";
"-" "1";
}
map "$limit_referer$limit_campaignid" $custom_limit {
default "";
"11" 1;
}
limit_req_zone $custom_limit zone=custom:1m rate=1r/s;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment