[PATCH 3 of 3] Limit req: change default response code when rate-limiting

Piotr Sikora piotrsikora at google.com
Tue Feb 28 23:40:01 UTC 2017


# HG changeset patch
# User Piotr Sikora <piotrsikora at google.com>
# Date 1488324535 28800
#      Tue Feb 28 15:28:55 2017 -0800
# Node ID c9d43c652ac776068e78f695dde00606eed184f8
# Parent  e21f12a958010e1f3e5cdc1640859e335e032ca5
Limit req: change default response code when rate-limiting.

Previously, "503 Service Unavailable" response code was used, but
the new "429 Too Many Requests" response code is more appropriate.

Signed-off-by: Piotr Sikora <piotrsikora at google.com>

diff -r e21f12a95801 -r c9d43c652ac7 src/http/modules/ngx_http_limit_req_module.c
--- a/src/http/modules/ngx_http_limit_req_module.c
+++ b/src/http/modules/ngx_http_limit_req_module.c
@@ -712,7 +712,7 @@ ngx_http_limit_req_merge_conf(ngx_conf_t
                                 NGX_LOG_INFO : conf->limit_log_level + 1;
 
     ngx_conf_merge_uint_value(conf->status_code, prev->status_code,
-                              NGX_HTTP_SERVICE_UNAVAILABLE);
+                              NGX_HTTP_TOO_MANY_REQUESTS);
 
     return NGX_CONF_OK;
 }


More information about the nginx-devel mailing list