I'm trying to use a Websocket on a Spring boot server.
I'd like to set the allowedOrigins to allow connections from everywhere like this :
@Configuration @EnableWebSocketclass WSConfig : WebSocketConfigurer {
override fun registerWebSocketHandlers(registry: WebSocketHandlerRegistry) {
registry.addHandler(ChatHandler(), "/chat").setAllowedOrigins("*").withSockJS()
}
}
But I get this error message :
When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header.
To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.] with root cause
The thing is that there isn't a method to set allowedOriginPatterns on WebSocketConfigurer. So I don't understand how I should manage this. Same for "Access-Control-Allow-Origin".
I think there is something that I misunderstood but I don't get what.
If you could help me understand ! Any help is appreciated :)