]> git.kaiwu.me - nginx.git/commitdiff
Upstream: fixed $upstream_status when upstream returns 503/504.
authorRuslan Ermilov <ru@nginx.com>
Wed, 11 Oct 2017 19:04:28 +0000 (22:04 +0300)
committerRuslan Ermilov <ru@nginx.com>
Wed, 11 Oct 2017 19:04:28 +0000 (22:04 +0300)
If proxy_next_upstream includes http_503/http_504, and upstream
returns 503/504, $upstream_status converted this to 502 for any
values except the last one.

src/http/ngx_http_upstream.c

index 2ea521b070e7deba5d3f007f5a17b2d663420d8a..c29ee97d86618698cff53201965bba08d9e31b4a 100644 (file)
@@ -4111,6 +4111,7 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
     switch (ft_type) {
 
     case NGX_HTTP_UPSTREAM_FT_TIMEOUT:
+    case NGX_HTTP_UPSTREAM_FT_HTTP_504:
         status = NGX_HTTP_GATEWAY_TIME_OUT;
         break;
 
@@ -4118,6 +4119,10 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
         status = NGX_HTTP_INTERNAL_SERVER_ERROR;
         break;
 
+    case NGX_HTTP_UPSTREAM_FT_HTTP_503:
+        status = NGX_HTTP_SERVICE_UNAVAILABLE;
+        break;
+
     case NGX_HTTP_UPSTREAM_FT_HTTP_403:
         status = NGX_HTTP_FORBIDDEN;
         break;