Local Testing with SSH Tunnels

Local testing

Browserling lets you cross-browser test your local web applications without a need to deploy your apps to the public Internet. With SSH tunnels you can easily test your application in all Browserling browsers. SSH tunnels are secure and easy to use, and it will take you just a few minutes to get started if you've never used them.

SSH tunnels work for localhost applications as well as local network applications. For example, you can test your application running at http://localhost or http://127.0.0.1. Or, if you've got a local development server somewhere on the network, you can access your application at http://www.local.network or http://10.5.5.1.

Local testing on Linux and Mac

Local testing on Linux and Mac is super simple! These operating systems already come with the necessary SSH tools to use tunneling. You only need to run a special ssh command that we generate for you to open a tunnel.

We've written a detailed guide with screenshots for local cross-browser testing on Linux and local cross-browser testing on Mac/OSX/macOS. Take a look!

Local testing on Windows

Local testing on Windows starting from Windows 10 is very easy as the SSH client is preinstalled. On older Windows versions such as Windows 8.1 or Windows 7 you will need to download a third-party SSH client of your choice, such as PuTTY.

We've also written a detailed guide with screenshots for local cross-browser testing on Windows. Take a look!

How does local testing work?

This illustration shows how the local testing with SSH tunnels works in Browserling:

You connect to the Browserling's tunneling server as well as browsers connect to the same tunneling server.

When you open and use an SSH tunnel, both you and the browsers connect to the tunneling server. The tunneling server is the meeting point for both of you. The tunneling server knows which tunnel sessions are associated with which Browserling browsers and when you test your site in Browserling, the connections go back to your local computer or local network computer.

What are local testing use cases?

Localhost Application Testing

You can test your web application running on http://localhost or http://127.0.0.1 using SSH tunnels. This way your local development environment can be tested across different browsers and operating systems without exposing it to the public Internet.

Network Application Testing

You can access and test applications hosted on local network servers (for example, http://10.5.5.1). This way you can verify a web application's functionality within an internal network setup before deploying to a live environment.

Testing Behind Firewalls

You can use SSH tunnels to test applications behind firewalls. Since the SSH tunnel creates a reverse connection to the Browserling tunneling server, it bypasses ingress firewall restrictions, allowing no-frills testing.

Test Apps Running on IPv6 and IPv4

You can ensure cross-browser compatibility by testing applications that resolve to ::1 (IPv6) and 127.0.0.1 (IPv4), and address potential issues arising from different IP versions to maintain consistent application behavior.

HTTP to HTTPS Testing

You can test a local HTTP server as an HTTPS server and vice versa. By generating local testing URLs with both http:// and https:// prefixes, you can test features that require HTTPS, like secure cookies, service workers, and HTTP/2.

Cross-Browser Compatibility

You can verify your web application's functionality across different browsers (such as Chrome, Firefox, Safari, Edge, etc.) by using SSH tunnels to route your local applications through Browserling's browsers.

Responsive Design Testing

You can test the responsiveness of your web application on different devices and screen sizes. SSH tunnels allow you to simulate various environments and ensure your application provides a neat user experience across all devices and screen sizes.

Cross-Origin Resource Sharing (CORS) Testing

You can verify that your application correctly handles CORS requests by testing local endpoints accessed through different domains and protocols (HTTP/HTTPS).

Authentication and Authorization Testing

You can test authentication and authorization mechanisms in your local environment using SSH tunnels to simulate real-world access scenarios, ensuring secure user access control.

Performance Testing on Local Setup

You can run performance testing on your local environment via SSH tunnels. This way, you can use your favorite tools and collect metrics locally to measure load times, resource usage, and overall performance to optimize your application before it goes live.

FAQ

Do SSH tunnels work behind firewalls?

Yes, they do! When you run the ssh command (as described in the Windows, Mac, and Linux guides guides), it opens something called a reverse tunnel. What that means is that you're making the connection to our tunneling server, and then when you test your site in Browserling's browsers, the web connection goes to the tunneling server first, and only then back to your computer. The browsers don't make a direct connection to your computer, so it works even if you're behind a firewall.

Why does a tunnel fail when using the "localhost" domain?

On most systems, the name localhost resolves to both ::1 (IPv6 loopback address) and 127.0.0.1 (IPv4 loopback address). If you use the name "localhost" in your SSH command, it will try to connect to the first address, which is ::1. This is fine if your local webserver is listening on ::1 or on both ::1 and 127.0.0.1. But if your server is only listening on 127.0.0.1 then the tunneling will fail as the addresses are different. To solve this issue, please replace ssh -R 1:localhost:8080 with ssh -R 1:127.0.0.1:8080 in your SSH command, where 8080 is your local web server's port.

Can I test a HTTPS version of my website without running HTTPS?

Yes, you can! Once you generate an SSH command from the Local Testing menu (inside Browserling), it will create two URLs for you: one of the URLs will be prefixed with https:// and the other with http://. Even if your local server is HTTP, you can use the https:// prefix to connect to it and access a HTTPS version. A useful use case is running Wasm, testing secure cookies, service workers, and HTTP/2 that only work over HTTPS.

Support

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