Welcome! Log In Create A New Profile

Advanced

Nginx as proxy to Node.js - weird issue

Posted by soulmate 
Nginx as proxy to Node.js - weird issue
July 14, 2013 04:46AM
Hi,

I have nginx set up as proxy to node.js for long polling like this:

location /node1 {
access_log off;
log_not_found off;
proxy_pass http://127.0.0.1:3001/node;
proxy_buffering off;
proxy_read_timeout 60;
break;
}

Unfortunately about half of long poll requests returns with error and empty response. I verified that is nginx issue as polling node.js directly with curl is always working and polling through website is reproing the issue. My version of nginx is the one dreamhost offers v.0.8.53.

Do you know how can I mitigate the issue and what can be the problem? The other GET, non-polling requests that are going same route are working just fine so I suspect some timeout issue. The long poll is set up for about 30 seconds in node.

Thanks for any help!
Re: Nginx as proxy to Node.js - weird issue
July 14, 2013 03:30PM
I turned on logging and it seems that the failed requests do not even appear in the access_log as if the nginx never received it. So the case is that:

querying node.js directly like:
curl --connect-timeout 60 --max-time 60 --form "username=User" http://127.0.0.1:3001/node/poll/2/1373730895/0/0

works fine, but going through nginx:

curl --connect-timeout 60 --max-time 60 --form "username=User" http://www.mydomain.com/node1/poll/2/1373730895/0/0

is failing in half cases - the failed cases do not appear in the access_log and the curl returns:
curl: (52) Empty reply from server

It might be connected with higher traffic volume as well as I don't see that yet on other site that has lower traffic and should have similar settings.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready