SpringBoot WebSocket 跨域报错:Origin header value not allowed. Even though URL is allowed

来源:互联网 发布:sql中is null什么意思 编辑:程序博客网 时间:2024/06/05 01:07

解决

@Configuration@EnableWebSocketMessageBrokerpublic class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {    @Override    public void registerStompEndpoints(StompEndpointRegistry registry) {        // the endpoint for websocket connections        registry.addEndpoint("/stomp").setAllowedOrigins("*").withSockJS();    }    // remaining config not shown as not relevant}
来自:https://stackoverflow.com/questions/32874421/websocket-in-spring-boot-app-getting-403-forbidden

阅读全文
0 0
原创粉丝点击