title: Socket.IO: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
body: <p>I have a strange issue in FF which is not reproduced in Chrome: websocket connection to another origin does not work when using SSL connection.</p>
  
  <p>My Rails app is running on <code>https://wax.lvh.me:3000</code> and socket.io node JS app is running on <code>https://wax.lvh.me:3001</code>. When I try to connect to the socket from the Rails app in FF I see the following warnings in the browser's dev console:</p>
  
  <p><a href="https://i.stack.imgur.com/PU8wk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PU8wk.png" alt="enter image description here"></a></p>
  
  <p>When I open the Network tab I see the following response headers - notice that there are no access-control headers in the response:</p>
  
  <p><a href="https://i.stack.imgur.com/HAcdu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HAcdu.png" alt="enter image description here"></a>
  I tried to use the following recipes from the others SO answers:</p>
  
  <p>Set up origins to <code>'*:*'</code> from <a href="https://stackoverflow.com/a/38749535/3676469">this answer</a></p>
  
  <pre><code>io = require('socket.io').listen(server)
  io.set('origins', '*:*');
  </code></pre>
  
  <p>Set up origins to a function from <a href="https://stackoverflow.com/a/53081944/3676469">this answer</a></p>
  
  <pre><code>io.origins (origin, callback) =&gt;
    if origin.match(/lvh\.me/)
      return callback(null, true)
  
    callback('Origin not allowed', false)
  </code></pre>
  
  <p>But nothing helped me to fix this issue so far</p>
  
  <p>Notice that access-control headers are set correctly in Chrome:</p>
  
  <p><a href="https://i.stack.imgur.com/4wG5M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4wG5M.png" alt="enter image description here"></a></p>
  
  <p>I use the following browser and tool versions:</p>
  
  <ul>
  <li>Firefox - 63.0.3 (64-bit)</li>
  <li>Google Chrome - Version 73.0.3683.39 (Official Build) beta (64-bit)</li>
  <li>Socket.io - 2.2.0</li>
  </ul>
  
  <p>Do you have any ideas how to set up CORS in socket.io for FF correctly?</p>