# Mysterious proxy timeout at 2 min

**URL:** <https://www.ruby-forum.com/t/mysterious-proxy-timeout-at-2-min/211044>\
**Category:** NGINX\
**Created:** [August 24, 2011, 12:06pm UTC](https://www.ruby-forum.com/t/mysterious-proxy-timeout-at-2-min/211044 "2011-08-24T12:06:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 24, 2011, 12:06pm UTC](https://www.ruby-forum.com/t/mysterious-proxy-timeout-at-2-min/211044/1 "2011-08-24T12:06:59Z")

</div>

Hello

I am configuring nginx to proxy to a node.js server which I am using  
for long-polling. I want nginx to hold the connection open just over 5  
minutes so that the node server can respond with content, or at least  
a 204, when it’s good and ready.

But nginx/1.1.0 keeps canceling with a 502 after exactly 2 minutes. I  
can’t find a a 2-minute timeout anywhere in my config.

I have the following:

upstream nodesub {  
server 127.0.0.1:8001;  
}

location /sub {  
send\_timeout 330s;  
proxy\_read\_timeout 330s;  
proxy\_connect\_timeout 30s;  
proxy\_pass [http://nodesub](http://nodesub);  
}

What am I missing, good people of the list?

Thomas

---

<div class="post-metadata">

**Author:** ![tlockney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tlockney](https://www.ruby-forum.com/u/tlockney)\
**Post date:** [August 24, 2011, 12:09pm UTC](https://www.ruby-forum.com/t/mysterious-proxy-timeout-at-2-min/211044/2 "2011-08-24T12:09:27Z")

</div>

Hello!

On Wed, Aug 24, 2011 at 12:06:13PM +0200, Thomas L. wrote:

> Hello
> 
> I am configuring nginx to proxy to a node.js server which I am using  
> for long-polling. I want nginx to hold the connection open just over 5  
> minutes so that the node server can respond with content, or at least  
> a 204, when it’s good and ready.
> 
> But nginx/1.1.0 keeps canceling with a 502 after exactly 2 minutes. I  
> can’t find a a 2-minute timeout anywhere in my config.

Error 502 suggests it’s not nginx timeout (error will be 504 then)  
but backend’s one.

Maxim D.

---

<div class="post-metadata">

**Author:** ![tlockney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tlockney](https://www.ruby-forum.com/u/tlockney)\
**Post date:** [August 24, 2011, 12:13pm UTC](https://www.ruby-forum.com/t/mysterious-proxy-timeout-at-2-min/211044/3 "2011-08-24T12:13:47Z")

</div>

On 24 August 2011 12:09, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Error 502 suggests it’s not nginx timeout (error will be 504 then)  
> but backend’s one.
> 
> Maxim D.

Thanks. I thought it might be. I’m scouring node…

Thomas

---

<div class="post-metadata">

**Author:** ![tlockney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tlockney](https://www.ruby-forum.com/u/tlockney)\
**Post date:** [August 24, 2011, 12:40pm UTC](https://www.ruby-forum.com/t/mysterious-proxy-timeout-at-2-min/211044/4 "2011-08-24T12:40:24Z")

</div>

On 24 August 2011 12:12, Thomas L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

Found it. For any other node fanboys: there’s a hardcoded 120-second  
idle timeout in node.js’s http.js, and to change it, call

request.socket.setTimeout(seconds \* 1000);

Thomas
