nginx_tcp_proxy_module icon indicating copy to clipboard operation
nginx_tcp_proxy_module copied to clipboard

timeouts

Open dcodix opened this issue 12 years ago • 7 comments

It is not an app issue.

I'm preparing to use this module as a websocket proxy and it works fine. The only thing is that the conection is not kept alive, but it is reset every minute. I found out there are some configuration timeouts, wich I suppose I have to give a huge value to minimize the restarts.

Anyway the "issue" would be that in the documentation here in github says timeouts are in miliseconds and, in my case I found out it works in secconds.

dcodix avatar Mar 15 '12 11:03 dcodix

Thanks. You are right. You should specify the timeout and proxy_read_timeout. The default time unit is miliseconds, but you can also specify like this:

10s = 10 seconds 10m = 10 minutes 10d = 10 day

etc...

On 2012/3/15 19:17, dcodix wrote:

It is not an app issue.

I'm preparing to use this module as a websocket proxy and it works fine. The only thing is that the conection is not kept alive, but it is reset every minute. I found out there are some configuration timeouts, wich I suppose I have to give a huge value to minimize the restarts.

Anyway the "issue" would be that in the documentation here in github says timeouts are in miliseconds and, in my case I found out it works in secconds.


Reply to this email directly or view it on GitHub: https://github.com/yaoweibin/nginx_tcp_proxy_module/issues/28

yaoweibin avatar Mar 15 '12 11:03 yaoweibin

Thanks.

It is working ok. Anyway to let you know. If I specify: timeout 120; proxy_connect_timeout 30; proxy_read_timeout 120; proxy_send_timeout 120; Those values, in my case, are understod as seconds. Anyway I will explicitly specify units.

Thanks a lot!

dcodix avatar Mar 15 '12 11:03 dcodix

Thanks you too, I'll check this issue.

On 2012-3-15 19:53, dcodix wrote:

Thanks.

It is working ok. Anyway to let you know. If I specify: timeout 120; proxy_connect_timeout 30; proxy_read_timeout 120; proxy_send_timeout 120; Those values, in my case, are understod as seconds. Anyway I will explicitly specify units.

Thanks a lot!


Reply to this email directly or view it on GitHub: https://github.com/yaoweibin/nginx_tcp_proxy_module/issues/28#issuecomment-4518116

yaoweibin avatar Mar 15 '12 13:03 yaoweibin

I'm working with the following config, and I'm getting 60sec timeouts regardless of my proxy_*_timeout values. Thoughts?

tcp {

 upstream websockets {
   server 127.0.0.1:55674;
   check interval=3000 rise=2 fall=5 timeout=1000;
 }

 server {
   listen 80;
   server_name example.local;

   tcp_nodelay on;
   proxy_pass websockets;

   proxy_connect_timeout 30;
   proxy_read_timeout 10d;
   proxy_send_timeout 10d;

 }

}

datafatmunger avatar Sep 01 '12 12:09 datafatmunger

You should also set the directive of 'timeout', which is the frontend timeout. Like this:

timeout 10d;| proxy_read_timeout 10d; proxy_send_timeout 10d;|

On 2012-9-1 20:45, bgraves wrote:

I'm working with the following config, and I'm getting 60sec timeouts regardless of my proxy_*_timeout values. Thoughts?

tcp {

| upstream websockets { server 127.0.0.1:55674; check interval=3000 rise=2 fall=5 timeout=1000; }

server { listen 80; server_name example.local;

tcp_nodelay on;
proxy_pass websockets;

proxy_connect_timeout 30;
proxy_read_timeout 10d;
proxy_send_timeout 10d;

} |

}

— Reply to this email directly or view it on GitHub https://github.com/yaoweibin/nginx_tcp_proxy_module/issues/28#issuecomment-8212582.

Thanks, -Weibin Yao

yaoweibin avatar Sep 02 '12 08:09 yaoweibin

Browsing the source code and a little help from http://stackoverflow.com/questions/12102110/nginx-to-reverse-proxy-websockets-and-enable-ssl-wss#comment16394844_12102112 I was able to get it working with:

tcp {

upstream websockets { server 127.0.0.1:55674; check interval=3000 rise=2 fall=5 timeout=1000;

}

server { listen 80; server_name stomp.ideedock.local;

timeout 43200000;
websocket_connect_timeout 43200000;
websocket_read_timeout 43200000;
websocket_send_timeout 43200000;
proxy_connect_timeout 43200000;
proxy_read_timeout 43200000;
proxy_send_timeout 43200000;

so_keepalive on;
tcp_nodelay on;

websocket_pass websockets;
websocket_buffer 1k;

}

}

datafatmunger avatar Sep 02 '12 08:09 datafatmunger

Thanks for this note. I'm happy that you could make it work.

You could use the directives just with websocket___timeout, the proxy___timeout is unnecessary.

On 2012-9-2 16:42, bgraves wrote:

Browsing the source code and a little help from http://stackoverflow.com/questions/12102110/nginx-to-reverse-proxy-websockets-and-enable-ssl-wss#comment16394844_12102112 I was able to get it working with:

tcp {

upstream websockets { server 127.0.0.1:55674; check interval=3000 rise=2 fall=5 timeout=1000;

}

server { listen 80; server_name stomp.ideedock.local;

|timeout 43200000; websocket_connect_timeout 43200000; websocket_read_timeout 43200000; websocket_send_timeout 43200000; proxy_connect_timeout 43200000; proxy_read_timeout 43200000; proxy_send_timeout 43200000;

so_keepalive on; tcp_nodelay on;

websocket_pass websockets; websocket_buffer 1k; |

}

}

— Reply to this email directly or view it on GitHub https://github.com/yaoweibin/nginx_tcp_proxy_module/issues/28#issuecomment-8220055.

Thanks, -Weibin Yao

yaoweibin avatar Sep 02 '12 08:09 yaoweibin