jeudi 16 avril 2015

Websockets over HTTPS 403 Forbidden

I am currently trying to setup HTTPS in my spring boot 1.2 application. This application uses a lot of websockets to communicate between two servers. When it is running on simple HTTP everything is works fine but when I switch it over to HTTPS I get a 403 Forbidden error on both Firefox and Chrome (Haven't tested it on IE.) I have a SimpleCORSFilter setup that accepts all connections so I don't think that is the problem. All of the normal HTTPS REST requests to the same server works, its just websockets that seem to be blocked.

Here is my WebSocket Spring Configuration



@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends
AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
config.setApplicationDestinationPrefixes("/app");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/simulation").withSockJS();
}
}


Here is my front end websocket connection



socket = new SockJS(https://my.url + '/simulation');
stompClient = Stomp.over(socket);
stompClient.debug = false;
stompClient.connect({}, function(frame) {
stompClient.subscribe('/topic/', function(status){
// Do something with result
});
});


EDIT: This is the error in the Chrome Console



GET https://localhost:8090/simulation/info 403 (Forbidden)
stomp.js:8 Whoops! Lost connection to undefined

Aucun commentaire:

Enregistrer un commentaire