Origin header value 'http://127.0.0.1:8080' not allowed.
@Configuration
@EnableWebSocketMessageBroker//注解使用STOMP协议传输基于代理消息
//注册STOMP协议节点,同时指定使用SockJS协议。
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/endpointClinical").setAllowedOrigins("*").withSockJS();
}
//由于我们是实现推送功能,这里的消息代理是/topic
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
//启动STOMP 代理中继功能,并将其代理目的地前缀设置为 "/queue"
config.enableSimpleBroker("/topic");
//应用程序开头
//config.setApplicationDestinationPrefixes("/app");
}
}
参考:https://stackoverflow.com/questions/32874421/websocket-in-spring-boot-app-getting-403-forbidden