diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index edd48ac9f..16a027a8a 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -1606,8 +1606,9 @@ ngx_http_upstream_intercept_errors(ngx_http_request_t *r, if (err_page[i].status == status) { - if (status == NGX_HTTP_UNAUTHORIZED) { - + if (status == NGX_HTTP_UNAUTHORIZED + && u->headers_in.www_authenticate) + { h = ngx_list_push(&r->headers_out.headers); if (h == NULL) {