websocket 由于无效的连接头[Keep-Alive],握手失败

6yt4nkrj  于 2023-08-05  发布在  其他
关注(0)|答案(1)|浏览(319)

我有一个WebSocket项目,在Weblogic 12 c和Spring MVC 5.1.0.RELEASE上开发
当我在本地tomcat上运行项目时,它工作正常,但当试图在Weblogic上部署时,它给出了下面的错误。(错误只发生在安全域,当我试图在http地址与ip其工作良好。)

Apr 09, 2021 2:28:57 PM org.springframework.web.socket.server.support.AbstractHandshakeHandler handleInvalidConnectHeader
SEVERE: Handshake failed due to invalid Connection header [Keep-Alive]
<Apr 9, 2021 2:28:57 PM GMT+03:00> <Error> <org.springframework.web.socket.server.support.DefaultHandshakeHandler> <BEA-000000> <Handshake failed due to invalid Connection header [Keep-Alive]>

字符串
我的标题;

- Sec-WebSocket-Version : 13
 - Sec-WebSocket-Key : MoTfrW6Iim1noQgYHlkeYQ==
 - Upgrade : websocket
 - Cookie : jwt=eyJhbGciO....
 - Sec-WebSocket-Extensions : permessage-deflate; client_max_window_bits
 - Host : blabla.com.tr
 - ECID-Context : 1.005jsZwLhO_EoIWVLynJ8A0001Cy0000i2;kXjE
 - Connection : Keep-Alive
 - X-WebLogic-KeepAliveSecs : 30
 - X-WebLogic-Force-JVMID : -414283189
 - X-WebLogic-Request-ClusterInfo : true


我的实现类似于;

@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
   registry.addHandler(new EchoHandler(), "/echo").addInterceptors(customHandshakeInterceptor())
                .setAllowedOrigins("*");
}


测试用;

wscat -c ws://localhost:8080/projectName/echo --no-color


有什么帮助吗?

bttbmeg0

bttbmeg01#

您需要将Connection头的值更改为“Upgrade”;

相关问题