Kaynağa Gözat

fix(www): dyndns: simplify rate limit (details handled by API)

Note that the real rate limit for the dyndns update endpoint is
handled more sensibly by the API itself (see api/api/settings.py).
The nginx configuration is just an upper bound for the worst case.
Peter Thomassen 5 yıl önce
ebeveyn
işleme
98ff2b01f1

+ 1 - 2
www/conf/nginx.conf

@@ -34,9 +34,8 @@ http {
     # if rate limits are exceeded, clients will receive a 503 answer (try again later)
     # if rate limits are exceeded, clients will receive a 503 answer (try again later)
     # rate limits are exceeded when the 'leaky bucket' is full
     # rate limits are exceeded when the 'leaky bucket' is full
 
 
-    # set up one bucket per remote ip for different types of (costly) API access
+    # set up one bucket per remote ip for (costly) API access
     limit_req_zone $binary_remote_addr zone=perip-api:100m rate=30r/s;
     limit_req_zone $binary_remote_addr zone=perip-api:100m rate=30r/s;
-    limit_req_zone $binary_remote_addr zone=perip-dyndns:100m rate=4r/m;
 
 
     # If limit_req directives are defined here, they apply to all servers that don't have their own ones
     # If limit_req directives are defined here, they apply to all servers that don't have their own ones
     #
     #

+ 3 - 5
www/conf/sites-available/15-dedyn-update.conf.var

@@ -20,7 +20,7 @@ server {
 	}
 	}
 
 
 	location / {
 	location / {
-		limit_req zone=perip-dyndns;
+		limit_req zone=perip-api;
 
 
 		include uwsgi_params;
 		include uwsgi_params;
 		rewrite ^(.*)$ /api/v1/dyndns/update?$1 break;
 		rewrite ^(.*)$ /api/v1/dyndns/update?$1 break;
@@ -53,8 +53,7 @@ server {
 	}
 	}
 
 
 	location / {
 	location / {
-		# max .5r/s to the API per IP. Allow burst as some people update multiple domains via cron.
-		limit_req zone=perip-api burst=10 nodelay;
+		limit_req zone=perip-api;
 
 
 		include uwsgi_params;
 		include uwsgi_params;
 		rewrite ^(.*)$ /api/v1/dyndns/update?$1 break;
 		rewrite ^(.*)$ /api/v1/dyndns/update?$1 break;
@@ -82,8 +81,7 @@ server {
 	}
 	}
 
 
 	location / {
 	location / {
-		# max .5r/s to the API per IP. Allow burst as some people update multiple domains via cron.
-		limit_req zone=perip-api burst=10 nodelay;
+		limit_req zone=perip-api;
 
 
 		include uwsgi_params;
 		include uwsgi_params;
 		rewrite ^(.*)$ /api/v1/dyndns/update?$1 break;
 		rewrite ^(.*)$ /api/v1/dyndns/update?$1 break;