我已经在Heroku上部署了一个应用程序。当我尝试从其他系统连接时,它工作正常。但是,当我尝试从公司的系统访问它时,它将获得此URL-
o.s.w.s.s.s.DefaultHandshakeHandler : Handshake failed due to invalid Upgrade header: null
我丢了this,但不知道如何在Heroku上配置Nginx。另外,我在某处阅读了所有dyno使用共同的运行时,因此它是不可配置的。 我在前端使用 SockJs ,在后端使用 Spring-Boot 。 来自浏览器的请求-
GET wss://ketu.herokuapp.com/gs-guide-websocket/873/l0ffiwck/websocket?
token=%22005e6574-9c25-4071-954b-70c8f2c79de2%22 HTTP/1.1
Host: ketu.herokuapp.com
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: https://ketu.herokuapp.com
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: JSESSIONID=4CE4921FCD813B9A4DBC7656F6D80286
Sec-WebSocket-Key: tSa9El0a/TL1fVdW586mhw==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
我的WebSocketConfig-
@EnableWebSocketMessageBroker
@Configuration
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer{
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/app");
registry.setUserDestinationPrefix("/user");
registry.enableSimpleBroker("/topic","/queue","/user");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/gs-guide-websocket").addInterceptors(new HandshakeInterceptorIml()).withSockJS();
}
}