Nginx may recieve data from Upstream Server even a request has not sent

Hagai Avrahami hagaia at
Tue Aug 4 06:47:09 UTC 2015


I am using Nginx as reverse Proxy, during testing I have noticed
a situation Nginx receives response from upstream server even no request
has been sent yet from Nginx side.

The scenario is that the "Upstream Server" started to transfer data just
the connection has established without waiting to request from Nginx, Nginx
receives all the response
and does not send the Proxied request.

I have looked in the code and realized Nginx allows to receive response
even without request
*or* maybe the AND should be OR (* (!u->request_sent ||
ngx_http_upstream_test_connect(c) != NGX_OK))*

static void
ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t
    ssize_t            n;
    ngx_int_t          rc;
    ngx_connection_t  *c;


* if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK)
{                        ngx_http_upstream_next(r, u,
NGX_HTTP_UPSTREAM_FT_ERROR);        return;    }*

Please Advise
Hagai Avrahami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list