title: Flask-Socket.IO CORS issue
body: <p>I am getting this error while connecting to my Flask app using socket.io</p>
  
  <blockquote>
    <p>GET <a href="http://127.0.0.1:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=1450525025659-286" rel="nofollow">http://127.0.0.1:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=1450525025659-286</a> Request.create @ socket.io.js:2919Request @ socket.io.js:2842XHR.request @ socket.io.js:2773XHR.doPoll @ socket.io.js:2803Polling.poll @ socket.io.js:3192Polling.doOpen @ socket.io.js:3136Transport.open @ socket.io.js:2313Socket.open @ socket.io.js:1743Socket @ socket.io.js:1625Socket @ socket.io.js:1560Manager.open.Manager.connect @ socket.io.js:299(anonymous function) @ socket.io.js:564
    :3004/:1 XMLHttpRequest cannot load <a href="http://127.0.0.1:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=1450525025659-286" rel="nofollow">http://127.0.0.1:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=1450525025659-286</a>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:3004" rel="nofollow">http://localhost:3004</a>' is therefore not allowed access. The response had HTTP status code 500.</p>
  </blockquote>
  
  <p>I tried this solution</p>
  
  <pre><code>@app.after_request
  def add_cors(resp):
      resp.headers['Access-Control-Allow-Origin'] = request.headers.get('Origin','*')
      resp.headers['Access-Control-Allow-Credentials'] = 'true'
      resp.headers['Access-Control-Allow-Methods'] = 'POST, OPTIONS, GET'
      resp.headers['Access-Control-Allow-Headers'] = request.headers.get(
      'Access-Control-Request-Headers', 'Authorization')
      return resp
  </code></pre>
  
  <p>But it did not work.
  I also tried Flask-Cors module</p>
  
  <pre><code>CORS(app, resources={
      r'/*/*': {
          'origins': '*',
          'allow_headers': ['Content-Type', 'Authorization']
      }
  })
  </code></pre>
  
  <p>and no gain.
  Any help would be appreciated</p>