Nginx TCP (WebSockets) Timeout / Keepalive Config Nginx TCP (WebSockets) Timeout / Keepalive Config nginx nginx

Nginx TCP (WebSockets) Timeout / Keepalive Config


I tried the websocket_*_timeout which are not supported on nginx 1.7.1 (it gives: unknown directive).

However setting a high proxy_*_timeout works:

proxy_connect_timeout 7d;proxy_send_timeout 7d;proxy_read_timeout 7d;

7d means 7 days, see official nginx configuration reference

Additionally you probably only have to set the proxy_read_timeout 7d; as that's the one that usually matter unless the server behind the proxy is very slow.


these brillant guys had the same problem and solved it ....

NGINX to reverse proxy websockets AND enable SSL (wss://)?

also, here in the original repo for that module is more instructions from the module author.

https://github.com/yaoweibin/nginx_tcp_proxy_module/issues/28

it basically amounts to adding websocket_*_timeout instructions in the server directive:

 server {     ....     websocket_connect_timeout ######;     websocket_send_timeout #####;     websocket_read_timeout #####;     ....         }