Invalid handshake response getStatus: 404 Not Found for a websocket connection
See original GitHub issueCloud Version : Greenwich.RELEASE Spring Boot Version: 2.1.6.RELEASE
I am trying to connect to a simple websocket and to route the connection through the gateway. Configuration is the following
routes:
- id: websocket
uri: ws://localhost:10000
predicates:
- Path=/ws/**
I then use a simple java client to try connecting through the gateway with the socket and I get the following error:
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 404
at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.verify(WebSocketClientHandshaker13.java:226) ~[netty-codec-http-4.1.36.Final.jar:4.1.36.Final]
at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.finishHandshake(WebSocketClientHandshaker.java:276) ~[netty-codec-http-4.1.36.Final.jar:4.1.36.Final]
at reactor.netty.http.client.WebsocketClientOperations.onInboundNext(WebsocketClientOperations.java:113) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE]
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:91) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) ~[netty-codec-4.1.36.Final.jar:4.1.36.Final]
I have not idea what I am doing wrong.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Gatling: WebSocketHandshakeException: Invalid handshake ...
How is this a bug? An empty path is an invalid URL, i.e. the bug is in the client not the server. ·...
Read more >Websocket: Invalid Handshake - Google Groups
I'm currently having issues getting my websocket to connect successfully. It seems to be due to the websocket handshake key received doesn't match...
Read more >Connection Server can not connect thingworx cluster
NettyChannelHandler - [ClientHandler: 9b8c888a] WebSocket error: Invalid handshake response getStatus: 403 Forbidden, closing connection!
Read more >Invalid handshake response getStatus: 404 · Issue #I4ZTPP
WebSocketClientHandshakeException: Invalid handshake response getStatus: 404. 网关配置: - id: test-netty uri: lb://test-netty predicates:
Read more >Error during WebSocket handshake: Unexpected response code
failed: Error during WebSocket handshake: Unexpected response code: 404 ... So I see now that you have put the Connection initialisation on the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @hectorlicea! I found the problem with your setup. The gateway was trying to connect to
ws://localhost:10000/ws/test-websocket/websocket
instead ofws://localhost:10000/test-websocket/websocket
. Adding theStripPrefix=1
filter in yourapplication.yml
file fixed the issue.Your route would look like this:
Hope that helped! 😃
我遇到了,没有解决 我也配置了 I encountered it and did not solve it. I also configured it
`r.netty.http.client.HttpClientConnect : [id: 0x27daedae, L:/192.168.3.26:52784 - R:192.168.3.26/192.168.3.26:9444] The connection observed an error
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 404 `