Socketio proxied throught Kong - Client connection keep closing

Viewed 2399

Summary

Client socket connection keeps getting disconnected, reconnect, disconnected, .... and so on

Steps To Reproduce

I am using Kong (https://github.com/Kong/kong) as a API gateway. The websocket server is proxied through Kong

Additional Details & Logs In picture: left terminal is server, right is client. Client log shows:

engine.io-client:socket socket close with reason: "transport close" +6s socket.io-client:manager onclose +1ms socket.io-client:manager cleanup +0ms socket.io-client:socket close (transport close) +0ms

enter image description here

P/s: Tried with a nginx proxy instead of Kong, and it works fine, the client socket connection stays without being closed.

1 Answers

I'm also having this issue and would like to contribute a possible clue for anybody stumbling on this. In my case, the reason behind the disconnection is the fact that KONG (or something between KONG and my browser) is stripping away the vital Connection: keep-alive and Keep-Alive: timeout=5 response headers. Socket IO does send a request header of Connection: keep-alive, but KONG seems to ignore it.

There is also an issue reported on GitHub that may be worth tracking: https://github.com/Kong/kong/issues/3008

We're currently investigating this and will update here if we find anything.

Related