Klaus Demo nginx / c3ce606
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> Piotr Sikora 2 years ago
3 changed file(s) with 29 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
100100 ngx_null_string, /* "419 unused" */
101101 ngx_null_string, /* "420 unused" */
102102 ngx_string("421 Misdirected Request"),
103
104 /* ngx_null_string, */ /* "422 Unprocessable Entity" */
105 /* ngx_null_string, */ /* "423 Locked" */
106 /* ngx_null_string, */ /* "424 Failed Dependency" */
107
108 #define NGX_HTTP_LAST_4XX 422
103 ngx_null_string, /* "422 Unprocessable Entity" */
104 ngx_null_string, /* "423 Locked" */
105 ngx_null_string, /* "424 Failed Dependency" */
106 ngx_null_string, /* "425 unused" */
107 ngx_null_string, /* "426 Upgrade Required" */
108 ngx_null_string, /* "427 unused" */
109 ngx_null_string, /* "428 Precondition Required" */
110 ngx_string("429 Too Many Requests"),
111
112 #define NGX_HTTP_LAST_4XX 430
109113 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
110114
111115 ngx_string("500 Internal Server Error"),
9797 #define NGX_HTTP_UNSUPPORTED_MEDIA_TYPE 415
9898 #define NGX_HTTP_RANGE_NOT_SATISFIABLE 416
9999 #define NGX_HTTP_MISDIRECTED_REQUEST 421
100 #define NGX_HTTP_TOO_MANY_REQUESTS 429
100101
101102
102103 /* Our own HTTP codes */
221221 "<head><title>421 Misdirected Request</title></head>" CRLF
222222 "<body bgcolor=\"white\">" CRLF
223223 "<center><h1>421 Misdirected Request</h1></center>" CRLF
224 ;
225
226
227 static char ngx_http_error_429_page[] =
228 "<html>" CRLF
229 "<head><title>429 Too Many Requests</title></head>" CRLF
230 "<body bgcolor=\"white\">" CRLF
231 "<center><h1>429 Too Many Requests</h1></center>" CRLF
224232 ;
225233
226234
353361 ngx_null_string, /* 419 */
354362 ngx_null_string, /* 420 */
355363 ngx_string(ngx_http_error_421_page),
356
357 #define NGX_HTTP_LAST_4XX 422
364 ngx_null_string, /* 422 */
365 ngx_null_string, /* 423 */
366 ngx_null_string, /* 424 */
367 ngx_null_string, /* 425 */
368 ngx_null_string, /* 426 */
369 ngx_null_string, /* 427 */
370 ngx_null_string, /* 428 */
371 ngx_string(ngx_http_error_429_page),
372
373 #define NGX_HTTP_LAST_4XX 430
358374 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
359375
360376 ngx_string(ngx_http_error_494_page), /* 494, request header too large */