Exposing a local web app to the internet

December 31st 2021 Debugging

If you do a lot of web development, I am sure there have been times when you have wanted to expose your application running on your local machine to the internet to debug why it's not behaving as expected. I know this has happened to me more than once. Let me give you a few recent examples:

Fortunately, there are tools that allow you to do this with minimal effort, and to certain extent even for free.

ngrok

The most advanced tool I have found is ngrok. It even has a built-in inspector for incoming requests.

To use it, you need to install a command line tool. It's also a good idea to sign up for an account and authenticate your client with the Authtoken you find in your dashboard. This will give you access to some of the more advanced features.

For occasional use, the free version should be sufficient. I have only exceeded the quota once, when I was testing an Ionic app on a phone and the browser made more than 40 connections in a minute. If that happens to you, you can pay for one of the other plans or choose a different tool.

Localtunnel

Localtunnel is not as feature rich as ngrok, but it's easier to set up and does not have the quota restrictions that ngrok has.

It can be installed as an NPM package, which can be handy if you are already developing with Node.js. No registration or login is required.

Localtunnel is an open source project, so third-party Go and . NET clients are also available. You can even host the server-side component yourself if you want to use your own domain.

Conveyor

Conveyor is not a cross-platform tool like the other two. It can only be used on Windows within Visual Studio. But if that's your development environment, it makes it more convenient to use.

It is available as an extension for Visual Studio 2022 and for some of the older Visual Studio versions. To expose your application to the internet you need to sign up for a (free) account and enter the credentials into the Visual Studio extension. There is also a Pro version that works even if you run your project without debugging, but I never needed that.

Most of the time, there's no need to expose the web application you are running locally to the internet. But if you want to troubleshoot a specific problem more efficiently, this option can be very useful. In this post, I have listed three tools I have used for this purpose in the past, and my experiences with them.

Get notified when a new blog post is published (usually every Friday):

Copyright
Creative Commons License