Error 400 when upgrading to websocket transport #1864
Unanswered
DaRealCodeWritten
asked this question in
Q&A
Replies: 1 comment 9 replies
-
I converted this to a discussion because at this time I don't really have an indication that there is a bug here. The "Invalid websocket upgrade" error occurs when the client sends a malformed websocket connection request, such as for example, one that does not include the proper upgrade HTTP headers. My guess is that your nginx configuration is causing this, and not your client. I suggest you look at the example configuration in the Flask-SocketIO documentation and try that approach to see if it helps. |
Beta Was this translation helpful? Give feedback.
9 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.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Flask-SocketsIO + Flask, attempts to use websockets as transport results in a 400 response code and a traceback on the client side, using
simple-websocket
as the WS framework and NGINX as the reverse proxyNginx config is as follows
Expected behavior
Website upgrades to WSS for the connection between the site and the bot
Actual behavior
Client throws the below traceback and the website refuses the upgrade
Logs
Python-SocketIO client (A discord bot)
Flask-SocketIO server (A flask app)
What i've tried so far
Changing the
https://
in thesock.connect()
call towss://
Modifying the order of the proxy directives in NGINX
Adding HTTP version directive in NGINX
Beta Was this translation helpful? Give feedback.
All reactions