Exposing a local web app to the internet
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:
- Checking how an Ionic app is rendered on iOS to try different solutions to a problem without having to rebuild and deploy the entire app for each change.
- Testing my implementation of Twitter cards and Open Graph sharing for Facebook while I was developing it.
- Debugging web hook calls from a SaaS product like IFTTT.
Fortunately, there are tools that allow you to do this with minimal effort, and to certain extent even for free.
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 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.
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.