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


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,
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© != NGX_OK))*

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

  • if (!u->request_sent && ngx_http_upstream_test_connect© != NGX_OK)
    { ngx_http_upstream_next(r, u,

Please Advise
Hagai A.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs