diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 984d30617..1654510be 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1748,6 +1748,7 @@ ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status, r->headers_out.status = status; if (status == NGX_HTTP_NO_CONTENT) { + r->header_only = 1; return ngx_http_send_header(r); } diff --git a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c index a8687d0a6..bccf63624 100644 --- a/src/http/ngx_http_header_filter_module.c +++ b/src/http/ngx_http_header_filter_module.c @@ -170,6 +170,10 @@ ngx_http_header_filter(ngx_http_request_t *r) #endif u_char addr[NGX_SOCKADDR_STRLEN]; + if (r->header_sent) { + return NGX_OK; + } + r->header_sent = 1; if (r != r->main) {