Wouldn’t it be nice to have the ability to check your features on your mobile phone or any external device, while you are developing an application.
Suppose you are building a website. You use the normal tooling to debug and develop the site. You want to test your image carousel swiping functionality on your mobilephone, while you are developing it.
You can of course publish your site to a server and access it from there, but that might be behind a CI/CD pipeline and other prosesses. Not to mention the build and deployment overhead everytime a small change is made.
Using SSH tunneling via localhost.run
localhost.run is a client-less tool to instantly make a locally running application available on an internet accessible URL. - localhost.run
You’ll be able to open your localhost environment to public endpoint with a single command.
ssh -R 80:localhost:8080 email@example.com
In this video I’m running Optimizely in a Docker container and opening the ssh connection from that container. That enables instantly inbound connections to the website. This could be any application that you are running locally.
Other use cases
- Share the dev environment temporarily to a client or a team for demo purposes
- Use cloud integration tools to communicate to your local environment (e.g. webhooks, Azure Logic Apps)
- Connect other devices in your local dev environment endpoints to test functionality (e.g. IoT devices)
And anything where you need an external connectivity to your local environment.
You should keep in mind that:
- The URL you open is in the public network and accessible by anyone who knows the endpoint while the SSH tunnel is open
- Please consider your company/client policies before using this technique and protect your application accordingly
Thank you for reading and watching. Feel free to give me a comment on Twitter.