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

**URL:** <https://www.ruby-forum.com/t/nginx-may-recieve-data-from-upstream-server-even-a-request-has-not-sent/242869>\
**Category:** NGINX\
**Created:** [August 4, 2015, 8:48am UTC](https://www.ruby-forum.com/t/nginx-may-recieve-data-from-upstream-server-even-a-request-has-not-sent/242869 "2015-08-04T08:48:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 4, 2015, 8:48am UTC](https://www.ruby-forum.com/t/nginx-may-recieve-data-from-upstream-server-even-a-request-has-not-sent/242869/1 "2015-08-04T08:48:19Z")

</div>

Hi,

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  
after  
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© != NGX\_OK))\*

static void  
ngx\_http\_upstream\_process\_header(ngx\_http\_request\_t \*r,  
ngx\_http\_upstream\_t  
\*u)  
{  
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,  
NGX\_HTTP\_UPSTREAM\_FT\_ERROR); return; }\*

Please Advise  
Thanks  
Hagai A.
