Expose your local 💻 web server to the world 🌐
Giorgos Kontopoulos 👀
Posted on January 17, 2020
Why ?
Web developers (mostly) develop on localhost using our preferred tools and languages and have a local server to test what we build. At times we might need to show a coleague or a client our progress or even test using online test tools such as browserstack.
It might be not worth the effort to deploy on a dev server to test a small change that we made or the process of deploying might be time consuming or might not have time to wait for deployment to finish.
Whatever the reason, no stress there is very easy way to expose our localhost using services such as localhost.run, serveo.net, ngrok.com, no-ip.com and there is probably others.
Perhaps the most well known are ngrok and no-ip.com but last time I checked you had to register to use them and hence I looked for easier ways and discovered the alternatives which I will present below.
For tutorials on how to use ngrok.com and/or no-ip.com I am sure you can find plenty on dev.to or just with a quick search.
How ?
Localhost.run can be used without registering you just need to call a simple command on your terminal
ssh -R 80:localhost:8080 ssh.localhost.run
Where 8080 is assumed to be the listening port of your local server.
Here is a simple example. Suppose you have your local development server running on port 3000 so you are testing things out by visting localhost:3000
.
On your terminal you would run
ssh -R 80:localhost:3000 ssh.localhost.run
And you would wait to get a response like the following
Connect to http://MACHINENAME-7zhx.localhost.run or https://MACHINENAME-7zhx.localhost.run
Now you can give 1 of the above links to anyone to access on the internet or use them in you external testing environment.
The server will be running until you terminate the process
That is all, nothing else to it, no need for registering or any other hassle and its a free service.
Similarly you can use serveo.net service with the following command
ssh -R 80:localhost:3000 serveo.net
For serveo check with their website before using as they have their ups and downs lately.
All similar services
- localhost.run (free, no registration)
- serveo.net (appears to be not working, free, no registration)
- ngrok.com (paid, free trial, also free with no registration)
- no-ip.com (paid, free trial, free with monthly re-registration)
- cloudflare argo tunnel (free, no registration)
- dyn.com (paid, free trial)
- Docker tunnel (free, needs setup)
- Docker tunnel (free, needs setup)
- Do it yourself tutorial (free, needs setup)
Please post any other similar services you have in mind or using with any advantages that they might have or send me any corrections to the above list.
WARNING
Some people have raised concerns in the comments that using such a service is actually in violation of your ISP's terms and conditions. This includes usage of any of the alternatives. There is probably a very slight possibility that an ISP can know or detect such a connection though.
Posted on January 17, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.