Testing box application from virtual machine

Box requires you to use HTTPS for any URL other than localhost. Unfortunately, I developed on a Linux virtual machine running inside a Windows machine, and I want to access the server running on Linux from a browser in Windows. Therefore, I cannot use localhost.

Is there a way that I test out my box application without needing to create a certificate on my Linux machine?


Yes. You can use an SSH tunnel.

  • Set up an SSH server on the Linux machine (make sure you secure it if it's accessible from the Internet)

  • Use a Windows SSH client (like plink or cygwin's SSH client) to create a tunnel to the desired port (80?) of the Linux box. For example, if you're using plink:

  • C:>plink.exe -L 1234:127.0.0.1:80 <username>@<Linux machine IP>

    using cygwin, the command would be the same:

    $ ssh -L 1234:127.0.01:80 <username>@<Linux machine IP>

    This will establish a tunnel between the Windows machine's local port 1234 (127.0.0.1:1234) and the Linux machines port 80 (127.0.0.1:80). So if you open a browser on the Windows machine and point it to 127.0.0.1:1234, you'll really be connecting to 127.0.0.1:80 of the Linux machine.

    There are some nice tutorials on SSH tunnels, but make sure you're reading about the right type of tunnel. They come in 3 forms - Local ( -L ), Remote ( -R ) and Dynamic ( -D ). You need the local one.

    To debug the tunnel, you can use nc . Use something like nc -l 127.0.0.1 80 to get nc to listen on 127.0.0.1:80, then try using the tunnel from the Windows browser. You should see the HTTP request in nc .

    链接地址: http://www.djcxy.com/p/18226.html

    上一篇: 构建它后,我找不到我的Docker镜像

    下一篇: 从虚拟机测试盒应用程序