Debug#Host Servers on your localhost

Abhishek Singhal
2 min readApr 14, 2020

--

Disclaimer: I am author from Staqlab Tunnel.This blog contains reference to services provided by tunnel-staqlab.
Do give me a thumbs up, if you find this blog useful

One of the major part of coder life is testing.When it comes to stand-alone consoles apps the testing is pretty easy.You just hook up some debug breakpoints in your favourite IDE and hit the debug button and vola you could see all the variables and inspect your code right-in where you placed your breakpoint.

But what if you rely on some external services to get your code working…

As for example, most of the REST/HTTP applications contains webhook routes from external services as a major part of the workflow.

You just want requests from these services to be forwarded to your localhost!!! But wait what, is this possible?
Can your localhost be connected over to the internet and traffic from web is forwarded to your local machine?

Yes this is possible through principles of SSH Tunneling.
There are already tunnels servers like Staqlab Tunnel which forwards traffic from web to your localhost.

The guide on staqlab is pretty self-explanatory. However lets discuss step-by-step procedure here also.
I will assume your server is running on localhost:3000
At the end of this tutorial you will be able to get a public url, which points to server running locally on port 3000.Do mind that the port can be any valid port.It doesn’t necessarily be 3000

Step 1:
Download tunnel client for you pc from https://tunnel.staqlab.com/downloads

Step 2:

Go to your downloads folder and unzip the zip file downloaded

Step 3:
Open terminal and navigate to folder where you have placed the downloaded file. and paste below command

./staqlab-tunnel 3000

if you want to have a custom domain.Look, its also possible.Replace above command with below command.

./staqlab-tunnel 3000 hostname=<your-domain>
e.g
./staqlab-tunnel 3000 hostname=kitty-lovers

After following above steps, you will be greeted with 3 urls on your terminal window.

First one, is inspector url. Its a powerful tool where you can investigate and replay all the http/https traffic from/to your server

The second and third url are http and https versions of the the public url which is in this case is
Just copy this url and paste it in your browser and see the magic, you can
see response from your pc on the your browser window.

Share this url with your colleagues, and display your work over the web!!

--

--