title: How to fix "Access-Control-Allow-Origin" error in a python socket-io server
body: <p>I'm creating a project that uses Vue.js (as a client) and Python (as a server). Python is used for some calculation and the Vue.js is used for the interface. I'm connecting them using python-socketio (<a href="https://python-socketio.readthedocs.io/en/latest/" rel="noreferrer">https://python-socketio.readthedocs.io/en/latest/</a>) and Vue-socket.io (<a href="https://github.com/MetinSeylan/Vue-Socket.io" rel="noreferrer">https://github.com/MetinSeylan/Vue-Socket.io</a>). Some weeks ago it was working just fine. The connection and communication was happening succefully. But a couple days ago I tried running the same code again and this error appeared: </p>
  
  <pre><code>► Access to XMLHttpRequest at shttp://localhost:2003/socket.io/?EI0.38transport.polling&amp;t=Mom6k2V' from origin 'http://1 :1 ocalhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 
  ► GET http://localhost:2003/socket.io/?EI0=3&amp;transport=polling&amp;t=Mom6k2V net::ERR FAILED vue-socketio.js?5132:8
  </code></pre>
  
  <p>I tried using old repositories that i knew for sure that were working but I got the same problem.</p>
  
  <p>I tried running the same code in another computer and in a Raspberry Pi and got the same problem.</p>
  
  <p>I tried running chrome with --disable-web-security in order to disable cors but I got the following error: </p>
  
  <pre><code>► WebSocket connection to 'ws://localhost:2003/socket.io/? vue-socketio.js?5132:10 EI0.3&amp;transport=websocket&amp;sid=7111830544fa4dfd98c3424afd25c10e failed: Error during WebSocket handshake: Unexpected response code: 400 
  </code></pre>
  
  <p>Server</p>
  
  <pre class="lang-py prettyprint-override"><code># -*- coding: utf-8 -*-
  import eventlet
  import socketio
  import numpy as np
  import json
  import serial
  import threading
  from scipy.integrate import odeint
  
  sio = socketio.Server()
  app = socketio.WSGIApp(sio, static_files={
      '/': {'content_type': 'text/html', 'filename': 'index.html'}
  })
  
  @sio.on('connect')
  def connect(sid, env):
      print('conectado ', sid)
  
  @sio.on('disconnect')
  def disconnect(sid):
      print('desconectado ', sid)
  
  # Other functionalities in the code 
  #...
  
  if __name__ == '__main__':
      print('Inicnando...')
      thread = threading.Thread(target=leitura_dados, args=(ser,))
      thread.start()
      eventlet.wsgi.server(eventlet.listen(('', 2003)), app)
  </code></pre>
  
  <p>Connection in the client</p>
  
  <pre><code>Vue.use(new VueSocketIO({
    debug: false,
    connection: 'http://localhost:2003'
  }))
  </code></pre>
  
  <p>I expected it to work as it did before. Without any CORS error or error during handshake. I have no idea why it suddenly stopped working.</p>