Local testing with SSH tunnels on Linux

Local testing on Linux

Linux comes with all the tools necessary to do local web application cross-browser testing in Browserling. It will take you less than 5 minutes to get going. Here's what you need to do:

  • Step 1 - Upload your public ssh key to your account.
  • Step 2 - Open and use the tunnel.

Uploading the public key to your account

On Linux your public key is located in the .ssh (dot ssh) directory in your home directory. Open the Linux shell/terminal and type cd ~/.ssh. This command will transfer you to the directory where your public (and private) keys are located:

The ~/.ssh directory contains your public and private keys.

If you get an error, then you don't have a private/public key yet! Create one with this command:

ssh-keygen -t rsa -C "email@example.com"

Next, type cat id_rsa.pub (or if you get an error type cat id_dsa.pub) to output your public key to the screen so you can copy it:

Use the cat id_rsa.pub or cat id_dsa.pub to output your public key to the screen.

Now copy the key and navigate to SSH Key Management page to upload it. Paste it in the ssh key text box and press Add:

Paste the public key in the text box and click Add.

You can add as many ssh keys as you like. If you use multiple computers, you can add the public key of every computer. Once you've done that, you can use the ssh tunnels to cross-browser test sites locally from every computer!

Using the SSH tunnel for local testing on Linux

To open a tunnel, start using Browserling and click the SSH Tunnel menu and choose Linux/Mac as your platform. Enter the hostname:port of your local web server. For example, localhost:80, or localhost:8080. You can also tunnel local area network servers, not just your localhost. For example, you can tunnel 10.1.1.25:80, or 192.168.5.2:40000:

Enter the host:port of your local web server and click Open tunnel.

Click Open tunnel and wait a few seconds. Browserling will open a tunnel for you. Next, copy the ssh command:

Copy the ssh -NR ... command and paste it to the command line.

Then, paste the ssh command to the command line:

Paste the ssh command to the shell.

If everything was successful, the command will just sit there and do nothing. At this point the tunnel is established. Now when you navigate to the tunnel URL in Browserling, your connection will go through to hostname:port that you entered.

To close the tunnel simply click Close tunnel in the tunnel menu and hit Ctrl+C in the Command Prompt to exit ssh.

Local testing on Windows and Mac/OSX/macOS

Not on Linux? Check out Local Testing on Windows and Local Testing on Mac guides!

Support

For technical support please contact us at support@browserling.com or use the support forum.