aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_special_response.c
diff options
context:
space:
mode:
authorPiotr Sikora <piotrsikora@google.com>2017-03-24 02:48:03 -0700
committerPiotr Sikora <piotrsikora@google.com>2017-03-24 02:48:03 -0700
commitc3ce606652aeac465895ab8eb8c6fc195d7db16b (patch)
treefc2b0a8afb19b4834c26347ba247bf7d3de15ccf /src/http/ngx_http_special_response.c
parent9ac9fe2f3ec82455aa561027e91d380d2db0f3af (diff)
downloadnginx-c3ce606652aeac465895ab8eb8c6fc195d7db16b.tar.gz
nginx-c3ce606652aeac465895ab8eb8c6fc195d7db16b.zip
Added support for "429 Too Many Requests" response (RFC6585).
This change adds reason phrase in status line and pretty response body when "429" status code is used in "return", "limit_conn_status" and/or "limit_req_status" directives. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Diffstat (limited to 'src/http/ngx_http_special_response.c')
-rw-r--r--src/http/ngx_http_special_response.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index 9de0d15aa..c9b101727 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -225,6 +225,14 @@ static char ngx_http_error_421_page[] =
;
+static char ngx_http_error_429_page[] =
+"<html>" CRLF
+"<head><title>429 Too Many Requests</title></head>" CRLF
+"<body bgcolor=\"white\">" CRLF
+"<center><h1>429 Too Many Requests</h1></center>" CRLF
+;
+
+
static char ngx_http_error_494_page[] =
"<html>" CRLF
"<head><title>400 Request Header Or Cookie Too Large</title></head>"
@@ -354,8 +362,16 @@ static ngx_str_t ngx_http_error_pages[] = {
ngx_null_string, /* 419 */
ngx_null_string, /* 420 */
ngx_string(ngx_http_error_421_page),
-
-#define NGX_HTTP_LAST_4XX 422
+ ngx_null_string, /* 422 */
+ ngx_null_string, /* 423 */
+ ngx_null_string, /* 424 */
+ ngx_null_string, /* 425 */
+ ngx_null_string, /* 426 */
+ ngx_null_string, /* 427 */
+ ngx_null_string, /* 428 */
+ ngx_string(ngx_http_error_429_page),
+
+#define NGX_HTTP_LAST_4XX 430
#define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
ngx_string(ngx_http_error_494_page), /* 494, request header too large */