How to access your localhost application on any device

gugacavalieri

Guga Cavalieri

Posted on September 18, 2019

How to access your localhost application on any device

I have always had problems while trying to test my applications on my localhost machine. The process was so painful that I would have to do some crazy port forwarding on my router (yes, using my internet provider public IP) or even deploy to staging environment server and access it on the desired device (sadly I did it once šŸ˜¢).

This was until the other day when my coworker (many thanks to Tays) came to me with a magical solution called ngrok. In a nutshell, ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels.

Alt Text

What?? I didnā€™t catch a thing there!

So, all it does, it takes a port on your computer and forwards it to ngrokā€™s server. This port is linked to a public URL that can be accessed anywhere in the world by any device!

Wait! Isnā€™t it dangerous to do that?

Well, we should be safe if we stick to only testing APIs and debugging web apps. We can deploy any application/API on our localhost, expose it using ngrok and then turn it off. And for those who are really worried about security, ngrok has an option to create a password protected tunnel. On top of that, every tunnel is secured through the HTTPS protocol.

My favourite use cases (so far) ā¤:

  • Test Web Apps using My Phone before deploying any code to the server
  • Debug OAuth integrations with external services
  • Many more! ā¤
šŸ’– šŸ’Ŗ šŸ™… šŸš©
gugacavalieri
Guga Cavalieri

Posted on September 18, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related