nginx: make rate limiting awesome
This commit is contained in:
parent
01811ee793
commit
4a2b25200a
6 changed files with 34 additions and 106 deletions
|
@ -3,16 +3,13 @@
|
|||
client_body_temp_path /var/log/nginx/client_body 1 2;
|
||||
server_name _;
|
||||
|
||||
set_real_ip_from 172.17.0.0/16;
|
||||
real_ip_header X-Forwarded-For;
|
||||
|
||||
keepalive_timeout 5;
|
||||
|
||||
if ($args ~ "_escaped_fragment_") {
|
||||
rewrite ^ /snapshot$uri;
|
||||
}
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-For $proper_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
|
@ -21,6 +18,8 @@ proxy_set_header Transfer-Encoding $http_transfer_encoding;
|
|||
|
||||
location / {
|
||||
proxy_pass http://web_app_server;
|
||||
|
||||
limit_req zone=webapp;
|
||||
}
|
||||
|
||||
location /realtime {
|
||||
|
@ -29,6 +28,18 @@ location /realtime {
|
|||
proxy_request_buffering off;
|
||||
}
|
||||
|
||||
location /v1/repositories/ {
|
||||
proxy_buffering off;
|
||||
|
||||
proxy_request_buffering off;
|
||||
|
||||
proxy_pass http://registry_app_server;
|
||||
proxy_read_timeout 2000;
|
||||
proxy_temp_path /var/log/nginx/proxy_temp 1 2;
|
||||
|
||||
limit_req zone=repositories;
|
||||
}
|
||||
|
||||
location /v1/ {
|
||||
proxy_buffering off;
|
||||
|
||||
|
@ -49,6 +60,8 @@ location /c1/ {
|
|||
proxy_pass http://verbs_app_server;
|
||||
proxy_read_timeout 2000;
|
||||
proxy_temp_path /var/log/nginx/proxy_temp 1 2;
|
||||
|
||||
limit_req zone=api;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
|
|
Reference in a new issue