Gorilla WebSocket disconnects after a minute

前端 未结 1 1039
独厮守ぢ
独厮守ぢ 2021-02-05 23:18

I\'m using Go (Golang) 1.4.2 with Gorilla WebSockets behind an nginx 1.4.6 reverse proxy. My WebSockets are disconnecting after about a minute of having the page open. Same beha

相关标签:
1条回答
  • 2021-02-05 23:45

    I had the same issue, the problem is the nginx configuration. It defaults to a 1 minute read timeout for proxy_pass:

    Syntax: proxy_read_timeout time;

    Default: proxy_read_timeout 60s;

    Context: http, server, location

    See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout

    In my case I've increased the timeout to 10 hours:

    proxy_read_timeout 36000s;

    0 讨论(0)
提交回复
热议问题