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

[🐛 Bug]: requests to /session/:id/se/vnc do not respect page origin, are hardcoded to 0.0.0.0:4444 #9980

Closed
skylarmb opened this issue Oct 23, 2021 · 8 comments

Comments

@skylarmb
Copy link

skylarmb commented Oct 23, 2021

What happened?

While running k8s-deployment-full-grid.yaml on a local minikube cluster, I noticed that viewing a session video via the Sessions tab makes a request to ws://0.0.0.0:4444 instead of having the request be relative to the host / origin of the page. All other requests correctly respect the document origin and make relative requests like /graphql etc. These requests seem to be initiated by LiveView.tsx connect() function

Screenshot from 2021-10-23 12-29-09

How can we reproduce the issue?

- deploy [k8s-deployment-full-grid.yaml](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/k8s-deployment-full-grid.yaml) to a local kubernetes cluster
- set up a local dns entry e.g. in `/etc/hosts/` for the selenium hub such as `selenium.local.test    192.168.49.2` or whatever the cluster IP or IP of `svc/selenium-router`
- navigate to the selenium hub dashboard on `selenium.local.test/ui/index.html`
- run a test against the selenium cluster to trigger a session
- navigate to the `Sessions` tab and click the video icon next to the session (🎥) to launch the in-browser vnc session
- observe `net::ERR_CONNECTION_REFUSED` due to the request failing to `ws://0.0.0.0:4444/session/:id/se/vnc` when the request should be sent to `ws://selenium.local.test/session/:id/se/vnc`
- run `kubectl port-forward svc/selenium-router -n default 4444:4444 --address='0.0.0.0'`, try to view the session again, observe that it now works

Relevant log output

value   websock.js:185:26
value   rfb.js:511:23
value   rfb.js:773:21
value   self-hosted:1222:27
(Async: setTimeout handler) n   rfb.js:286:8
n/i.connect LiveView.tsx:96:15
value   LiveView.tsx:108:9
ps  react-dom.production.min.js:219:410
Ml  react-dom.production.min.js:259:159
...

Operating System

Ubuntu

Selenium version

4.0.0, nodejs

What are the browser(s) and version(s) where you see this issue?

Chrome 94

What are the browser driver(s) and version(s) where you see this issue?

Chromedriver 94

Are you using Selenium Grid?

4.0.0

@github-actions
Copy link

@skylarmb, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Oct 25, 2021

Seems we should fix the url when it is read from the returned capabilities here. Probably parsing it a replacing the necessary bits with the document origin.

@diemol diemol added the help wanted Issues looking for contributions label Oct 25, 2021
@github-actions
Copy link

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

@titusfortner
Copy link
Member

This might be the cause of this #9976 only with 0.0.0.0:4444/session/:id/se/cdp

@pujagani
Copy link
Contributor

pujagani commented Oct 26, 2021

I think if this is fixed then it might help fix #9803. When attempted to reproduce locally with docker, the Grid attempts to connect to ws://<grid-host>:<grid-id>/session/:id/se/cdp for creating a CDP connection.

@diemol
Copy link
Member

diemol commented Oct 26, 2021

I am not sure, I think those are different issues. I will have a look at the Grid code and report back.

@diemol diemol removed the help wanted Issues looking for contributions label Nov 5, 2021
@diemol diemol closed this as completed in ca9b451 Nov 5, 2021
@skylarmb
Copy link
Author

skylarmb commented Nov 23, 2021

❤️ thanks for the quick fix!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 24, 2021
elgatov pushed a commit to elgatov/selenium that referenced this issue Jun 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants