title: How to enable cross-origin requests in Grails websocket plugin
body: <p>I tried to override the default configuration of the <a href="https://github.com/zyro23/grails-spring-websocket" rel="nofollow">spring websocket plugin</a> for Grails, like this :</p>
  
  <pre><code>@Configuration
  @EnableWebSocketMessageBroker
  class CorsWebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
  
      @Override
      void configureMessageBroker(MessageBrokerRegistry messageBrokerRegistry) {
          messageBrokerRegistry.enableSimpleBroker "/queue", "/topic"
          messageBrokerRegistry.setApplicationDestinationPrefixes "/app"
      }
  
      @Override
      void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
          StompWebSocketEndpointRegistration registration = stompEndpointRegistry.addEndpoint("/stomp")
          registration.setAllowedOrigins('http://localhost', 'http://localhost:8080')
          registration.withSockJS().setSupressCors(false)
      }
  
     // [...]
  }
  </code></pre>
  
  <p>I also tried by doing a .setAllowedOrigins('*'), but it still won't work. </p>
  
  <p>However, when I register my client, the "Access-Control-Allow-Origin" header is never set on the /stomp/info endpoint. I always get "XMLHttpRequest cannot load <a href="http://localhost:8080/app/stomp/info" rel="nofollow">http://localhost:8080/app/stomp/info</a>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost" rel="nofollow">http://localhost</a>' is therefore not allowed access."</p>