Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocketBadStatusException raised when connecting to webSocketDebuggerUrl in Chrome 108+ #59

Open
realwumbl3 opened this issue Feb 21, 2023 · 7 comments

Comments

@realwumbl3
Copy link

When using PyChrome to connect to a tab's "webSocketDebuggerUrl" in Chrome 108 or newer, the following error is raised: "websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden".

@jerivas
Copy link

jerivas commented Mar 13, 2023

Seems to be related to Chrome checking the Origin of the incoming request. The recommended fix seems to be to suppress the header entirely: https://bugs.chromium.org/p/chromium/issues/detail?id=1422444#c5

I added an extra kwarg suppress_origin=True and that fixed the issue.

self._ws = websocket.create_connection(self._websocket_url, enable_multithread=True)

@realwumbl3
Copy link
Author

I tried it and that worked! Thanks and good job! 💖

yipsang pushed a commit to yipsang/pychrome that referenced this issue Mar 21, 2023
@sc231997
Copy link
Contributor

suppress_origin=True

This fix worked. Can you raise the PR for this?

@jerivas
Copy link

jerivas commented Mar 29, 2023

@sc231997 feel free to include it in #62

@sc231997
Copy link
Contributor

@sc231997 feel free to include it in #62

Done!

fcayre added a commit to commown/commown-odoo-addons that referenced this issue Jul 20, 2023
See fate0/pychrome#59
With chrome 108+, this exception is raised: websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden
On github CI, chrome 112.0.5615.121 is currently installed and leads to that crash.
fcayre added a commit to commown/commown-odoo-addons that referenced this issue Jul 21, 2023
See fate0/pychrome#59
With chrome 108+, this exception is raised: websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden
On github CI, chrome 112.0.5615.121 is currently installed and leads to that crash.
fcayre added a commit to commown/commown-odoo-addons that referenced this issue Jul 21, 2023
See fate0/pychrome#59
With chrome 108+, this exception is raised: websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden
On github CI, chrome 112.0.5615.121 is currently installed and leads to that crash.
@rrfaria
Copy link

rrfaria commented Sep 13, 2023

version(0.2.4) I'm using has this suppress_origin=True and still not working

independent of any port I use.

chrome version: 117.0.5938.63

@milahu
Copy link

milahu commented Nov 22, 2023

still not working

start chrome with one of

--remote-allow-origins=http://localhost:5222
--remote-allow-origins=*

chrome will print this to stderr

[ERROR:devtools_http_handler.cc(768)] Rejected an incoming WebSocket connection from the http://localhost:5222 origin. Use the command line flag --remote-allow-origins=http://localhost:5222 to allow connections from this origin or --remote-allow-origins=* to allow all origins.

see also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants