Flask SocketIO CORS Error After Deploy #1762
Unanswered
selmanbaskaya
asked this question in
Q&A
Replies: 1 comment 15 replies
-
I think your attempt to obscure your real hostname is complicating this issue, because I assume you are not really using The error as you are showing it makes no sense, because it complains about a different origin, while in fact the two URLs shown in the error message have the same origin. |
Beta Was this translation helpful? Give feedback.
15 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ERROR: Access to XMLHttpRequest at 'https://blabla.com/socket.io/...' from origin 'https://blabla.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I am using Flask SocketIO with VueJs. Everything works fine in my local, but after deploy I started getting CORS error.
I checked the documentation but couldn't find the cause of the error.
** I added cors_allow_origins='*' option for the socket io initialization.
my init.py file is here:
.
.
.
app = Flask(name)
CORS(app)
socketio = SocketIO(app, cors_allowed_origins="*")
.
.
.
my main.py file is here:
.
.
.
if name == "main":
socketio.run(app)
Beta Was this translation helpful? Give feedback.
All reactions