我有一个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
型
有什么帮助吗?
1条答案
按热度按时间bttbmeg01#
您需要将Connection头的值更改为“Upgrade”;