title: Browser not connecting to Springboot Websocket (sockjs)
body: <p>I have a SpringBoot server running on localhost:8080
  and npm (serving a React app) on localhost:3000</p>
  
  <p>Whenever I try to establish a websocket connection to spring, this shows up on the browser's console (Firefox Nightly):</p>
  
  <pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading
  the remote resource at http://localhost:8080/ws/info?t=1522629329791. 
  (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match 
  ‘http://localhost:8080/ws/info’).
  </code></pre>
  
  <p>I've created a <code>WebSocketMessageBrokerConfigurer</code> class and tried to <code>setAllowedOrigins</code> width both null and <code>http://localhost:3000</code> (and <code>127.0.0.1</code> as well):</p>
  
  <pre><code>@Override
  public void registerStompEndpoints(StompEndpointRegistry registry) {
      registry.addEndpoint("/ws")
              .setAllowedOrigins("http://localhost:3000")
              .withSockJS();
  }
  </code></pre>
  
  <p>REST requests are working fine, and I even made it to connect to the websocket in a simple node script, but within the browser I've had no luck. This is how I'm connecting in the browser (same as in script):</p>
  
  <pre><code>import Stomp from 'stompjs';
  import SockJS from 'sockjs-client';
  ...
  let ws = new SockJS('http://localhost:8080/ws/');
  let client = Stomp.over(ws);
  client.connect({'some-header': 'some-data'}, (success) =&gt; {   
          //client.subscribe(...
  }, (error) =&gt; {
      console.log(error)
  })
  </code></pre>
  
  <p>Can someone help me? Thanks in advance.</p>