Spring WebSocket Connecting with SockJS to a different domain

Jax’s answer was correct 🙂

The registerStompEndpoints method gives us the opportunity to set the Allowed Origins.
We need to add it before the “withSockJs()” option.

    @Override
    public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
        stompEndpointRegistry.addEndpoint("/BO/socket").setAllowedOrigins("*").withSockJS();
    }

Leave a Comment