Websocket disconnect after 60s of inactivity

I am using Kong with websocket and after 60s of inactivity the client is disconnected. Here the message that get the client

Disconnected (code: 1006)

I know it comes from Kong because with a direct connection to the downstream server it doesn’t happen.
I’m fine with the disconnect after X time, but how to modify this time ?

I have tried with this env variable KONG_NGINX_PROXY_PROXY_IGNORE_CLIENT_ABORT=on but it don’t seems to fix it.

Hi @tclairet,

Probably it’s a Nginx feature, not kong.

So following the next doc:

http://nginx.org/en/docs/http/websocket.html

can you try with KONG_NGINX_READ_TIMEOUT? it should work.

other approach is following this approach:

Alternatively, the proxied server can be configured to periodically send WebSocket ping frames to reset the timeout and check if the connection is still alive.

The default read timeout in Kong for any service is 60 second:

That is probably causing the connections to close.

1 Like

Thanks @hbagdi, that did the trick !


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ