meshcat-dev / meshcat-python

WebGL-based 3D visualizer for Python
MIT License
253 stars 63 forks source link

Remote access via ssh #61

Open nitin-ppnp opened 4 years ago

nitin-ppnp commented 4 years ago

How can I access the meshcat server via ssh port forwarding? Right now If I try to access, it gives "404: Not Found" error

fishbotics commented 2 years ago

Adding a little bit extra info here. Would be great to hear your thoughts @rdeits.

I have two machines on my local network (so they can be accessed over ssh without any kind of fancy tunneling). When I start meshcat on one machine with

import meshcat
vis = meshcat.Visualizer()

I can load it in my browser at 127.0.0.1:7000 and everything is great. If I try to load the URL on my other machine using the IP address of the first machine (e.g. going to the browser and typing 192..._:7000), I get an error saying Can "Upgrade" only to "WebSocket"..

Did a bit more digging on this and it seems to be an issue with Tornado and the upgrade header not being set correctly. I'm not sure where to go from there to fix it. Any suggestions?

district10 commented 1 year ago

I thought I met the same problem, but after changing http://<your_ip>:7000/static to http://<your_ip>:7000/static/ (with a trailing /), it works now...

zongmianli commented 1 year ago

People having this issue can follow these steps for troubleshooting:

  1. Install and enable ssh server on the remote machine
  2. Generate ssh key and upload the public key to the remote
  3. connect to the remote via ssh tunneling, via something like
    ssh -L <local_port>:localhost:<remote_port> <remote_username>@<remote_public_ip>

    Here is a concrete example (with random ip and user name )

    ssh -L 7000:localhost:4000 foo@130.16.239.193

    Let's say meshcat is running on the remote machine@130.16.239.193, with port 4000. Then Meshcat should show up at http://localhost:7000/ on the local computer.