-2

I just finished this tutorial and it works on localhost (when I'm run backend on localhost:8080 and front on localhost:4200), but when I put my *.war file on server there is some CORS problem.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ‘http://mydomain.pl/ws/info?t=1591451334475’. (Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’)

I change this to allow but this not working :(

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
    registry.addEndpoint("/ws")
            .setAllowedOrigins("*")
            .withSockJS();
}

Could You hep me? I don't know what I'm doing wrong

1
  • Otherwise try .setAllowedOrigins("http://localhost:4200")
    – David
    Jun 6, 2020 at 19:01

1 Answer 1

0

The problem is wildfly. I just run jar on server without wildfly and the websocket works correctly. I'm probably don't configured something in wildfly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.