[PATCH 2 of 2] HTTP: change default response code when rate-limiting requests

Piotr Sikora piotrsikora at google.com
Wed Oct 19 07:51:44 UTC 2016


# HG changeset patch
# User Piotr Sikora <piotrsikora at google.com>
# Date 1476859163 25200
#      Tue Oct 18 23:39:23 2016 -0700
# Node ID cff70893f20b18623ed45c8406050bcf5db78a48
# Parent  1eec5355ef1e4a8b0aecebdec84c744734c0d36e
HTTP: change default response code when rate-limiting requests.

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 1eec5355ef1e -r cff70893f20b 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