aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream.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
commitca1a5057e2a0429350ec2d07c4616a75e34424e3 (patch)
tree1f541379013606a8dc6505a26f3ca8710de085e2 /src/http/ngx_http_upstream.c
parentc3ce606652aeac465895ab8eb8c6fc195d7db16b (diff)
downloadnginx-ca1a5057e2a0429350ec2d07c4616a75e34424e3.tar.gz
nginx-ca1a5057e2a0429350ec2d07c4616a75e34424e3.zip
Upstream: allow recovery from "429 Too Many Requests" response.
This change adds "http_429" parameter to "proxy_next_upstream" for retrying rate-limited requests, and to "proxy_cache_use_stale" for serving stale cached responses after being rate-limited. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r--src/http/ngx_http_upstream.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 43079563d..36952860c 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -436,6 +436,7 @@ static ngx_http_upstream_next_t ngx_http_upstream_next_errors[] = {
{ 504, NGX_HTTP_UPSTREAM_FT_HTTP_504 },
{ 403, NGX_HTTP_UPSTREAM_FT_HTTP_403 },
{ 404, NGX_HTTP_UPSTREAM_FT_HTTP_404 },
+ { 429, NGX_HTTP_UPSTREAM_FT_HTTP_429 },
{ 0, 0 }
};
@@ -4126,6 +4127,10 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
status = NGX_HTTP_NOT_FOUND;
break;
+ case NGX_HTTP_UPSTREAM_FT_HTTP_429:
+ status = NGX_HTTP_TOO_MANY_REQUESTS;
+ break;
+
/*
* NGX_HTTP_UPSTREAM_FT_BUSY_LOCK and NGX_HTTP_UPSTREAM_FT_MAX_WAITING
* never reach here