diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index f8d5707d3..736ab6349 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -4374,8 +4374,7 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r, if (!u->header_sent || rc == NGX_HTTP_REQUEST_TIME_OUT - || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST - || (u->pipe && u->pipe->downstream_error)) + || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST) { ngx_http_finalize_request(r, rc); return; @@ -4388,7 +4387,9 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r, flush = 1; } - if (r->header_only) { + if (r->header_only + || (u->pipe && u->pipe->downstream_error)) + { ngx_http_finalize_request(r, rc); return; }