nginx: rate limiting only on proxy protocol

This commit is contained in:
Jimmy Zelinskie 2015-01-23 16:04:06 -05:00
parent 558debc1cb
commit 64bea5387b
3 changed files with 10 additions and 4 deletions

View file

@ -26,6 +26,8 @@ http {
server {
include proxy-protocol.conf;
set $ratelimit 1;
include server-base.conf;
listen 8443 default proxy_protocol;

View file

@ -1,6 +1,6 @@
# vim: ft=nginx
limit_req_zone $binary_remote_addr zone=webapp:10m rate=10r/s;
limit_req_zone $binary_remote_addr zone=api:10m rate=1r/s;
limit_req_zone $proxy_protocol_addr zone=webapp:10m rate=10r/s;
limit_req_zone $proxy_protocol_addr zone=api:10m rate=1r/s;
limit_req_status 429;
limit_req_log_level warn;

View file

@ -42,7 +42,9 @@ location /v1/ {
client_max_body_size 20G;
#limit_req zone=api burst=5 nodelay;
if ($ratelimit) {
limit_req zone=api burst=5 nodelay;
}
}
location /c1/ {
@ -54,7 +56,9 @@ location /c1/ {
proxy_read_timeout 2000;
proxy_temp_path /var/log/nginx/proxy_temp 1 2;
#limit_req zone=api burst=5 nodelay;
if ($ratelimit) {
limit_req zone=api burst=5 nodelay;
}
}
location /static/ {