hydra-proxy: limit per client request rate
Put a rate limit on per source adress requests to hydra-server > Excessive requests are delayed until their number exceeds the maximum burst size in which case the request is terminated with an [error](https://nginx.org/en/docs/http/ngx_http_limit_req_module.html#limit_req_status). https://nginx.org/en/docs/http/ngx_http_limit_req_module.html
Martin Weinelt committed
Jul 17, 2025 at 14:39 UTC
7ecb0ef98fbf8060f7bb5d4ac9f3f9f692bb8b93
1 file changed
+6
build/hydra-proxy.nix
+6
@@ -43,6 +43,9 @@
43
default "anubis";
44
nix.dev-Uogho3gi "hydra-server";
45
}
46
+
47
+ limit_req_zone $binary_remote_addr zone=hydra-server:8m rate=2r/s;
48
+ limit_req_status 429;
49
'';
50
51
eventsConfig = ''
@@ -77,6 +80,9 @@
80
81
locations."/" = {
82
proxyPass = "http://$upstream";
83
+ extraConfig = ''
84
+ limit_req zone=hydra-server burst=5;
85
+ '';
86
};
87
88
locations."~ ^/build/\\d+/download/" = {