One of the more annoying things when developing on your local computer is that your clients or friends can’t see what you develop. You can upload it on your web server or you can work directly on the web server but that is inconvenient and slow. So I was very happy to discover this great tool called ngrok. There are similar tools (localtunnel etc) but this one is really easy to use.
Who is your daddy and..no..wait..what is ngrok and what does it do?
Ngrok is a cool little program that creates a tunnel from the public internet (http://subdomain.ngrok.com) to a port on your local machine. You can give this URL to anyone to allow them to try out a web site you’re developing without doing any deployment. Of course your local server has to run at the time of sharing but that is not a problem – you just leave your PC on.
How do I run this ngrok?
With ngrok it is super simple to expose a local web server to the internet. On Windows you just download ngrok.exe, unzip it some folder and then in command prompt (cmd) you just tell ngrok which port your web server is running on.
This is the most simple way (This opens port 8080 on your local machine to the internet). Type this in your command prompt:
ngrok 8080
You will see something like this :
Tunnel Status online Version 0.11/0.8 Protocol http Forwarding http://345355bc.ngrok.com -> 127.0.0.1:8080 Web Interface http://localhost:4040 # Conn 0 Avg Conn Time 0.00ms
Of course the port (in this case 8080) has to be the port that your localhost is running on. Now just give the generated URL (in our example http://345355bc.ngrok.com
) to your client or friend and let them test out your application.
You can do a lot more with ngrok, like inspecting your traffic, XML/JSON syntax checking, replaying requests, requiring passwords to access your tunnels, accessing your tunnels over HTTPS, forwarding non-HTTP services, forwarding to non-local services and more.
Check out ngrok here.