log status actually not real status

crasyangel nginx-forum at forum.nginx.org
Wed Aug 31 08:30:51 UTC 2016


Nginx would log status to 200 after response header had sent when upstream
prematurely closed connection
I think nginx should log status to 502, even though client recv 200

static u_char *
ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t
*op)
{
    ngx_uint_t  status;

    if (r->err_status) {
        status = r->err_status;

    } else if (r->headers_out.status) {
        status = r->headers_out.status;

    } else if (r->http_version == NGX_HTTP_VERSION_9) {
        status = 9;

    } else {
        status = 0;
    }

    return ngx_sprintf(buf, "%03ui", status);
}

r->err_status should be set in this situation

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269301,269301#msg-269301



More information about the nginx mailing list