[Vuejs]-VueJS client cannot connect to Flask server

4👍

Recent versions of Flask-SocketIO come configured with the most secure settings with regards to cross-origins setup, which is to only allow the same origin. If your Vue app and your Flask app are running on different ports, then you have to configure cross-origin.

For example, if your Vue app is hosted at http://localhost:8080, you can allow that as an origin with:

socketio = SocketIO(app, cors_allowed_origins='http://localhost:8080')

Leave a comment