spring-guides / gs-messaging-stomp-websocket

Using WebSocket to build an interactive web application :: Learn how to the send and receive messages between a browser and the server over a WebSocket

Home Page:http://spring.io/guides/gs/messaging-stomp-websocket/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allowed origins

ShulV opened this issue · comments

Didn't work for me without additional permission.
I launched the front using "Live Server" in VS Code on 5500 port.
I had to add the line .setAllowedOrigins("http://127.0.0.1:5500/") to make it work.

@Override
	public void registerStompEndpoints(StompEndpointRegistry registry) {
		registry.addEndpoint("/gs-guide-websocket")
				.setAllowedOrigins("http://127.0.0.1:5500/");//I added it
	}

Didn't work for me without additional permission. I launched the front using "Live Server" in VS Code on 5500 port. I had to add the line .setAllowedOrigins("http://127.0.0.1:5500/") to make it work.

@Override
	public void registerStompEndpoints(StompEndpointRegistry registry) {
		registry.addEndpoint("/gs-guide-websocket")
				.setAllowedOrigins("http://127.0.0.1:5500/");//I added it
	}

.setAllowedOrigins("*")