A Modern Way to Exposing Localhost to Internet
As developers, we often want to quickly share local website, jupyter notebooks or local experiments with colleagues for feedback and testing before deploying to production. However, opening up access to development servers running on our own machines usually requires messing around with DNS records, firewall rules, and port forwarding. Reverse tunnelling is an easy solution to that problem. It works by having your local machine open an outbound connection to a secure proxy server. This outbound tunnel can then route traffic back to specified localhost ports on your machine through the secure pipe established with the server. The benefit of reverse tunneling is that it avoids the need for error-prone firewall and router port forwarding configuration and also provides an additional layer of security since your machine pulls data from external clients rather than directly exposing open ports for connections.
While there are various tools that provide reverse tunneling as a service, Localportal offers an easy solution. It is a platform of utilities built around reverse tunneling technology, including features like an instant terminal, a "native-like" filesystem, and more. These are all accessible from a pseudo desktop crafted by Localportal and available to you via a public URL when you connect your local machine to Localportal. But not only the inbuilt apps that you have available, you can expose a server that you ran to the internet as well. With just a few clicks, you can securely expose a locally running server (we have specifically tested it with nextjs, nuxtjs, and other nodejs servers, as well as Python and Go servers), or internal services like Jupyter notebooks and ollama server, to the internet without complex networking configuration. The servers remain the same and should function without issues.
Installation
Installing Localportal varies depending on the platform. On a Mac, you can use Brew, while for Linux and Windows (WSL), there is a script available that can be installed using curl and your shell.
Mac
brew install localportal/tap/localportal
Linux / WSL (Windows)
curl -L https://localportal.io/install | sh
Connecting your Machine
Once installed, you can connect your machine to the Localportal server using the "link" command. This creates a persistent, secure connection to the Localportal server and provides you with a public, HTTPS URL to access your pseudo desktop (an artificially crafted desktop that loads in the browser - note that it's not the same desktop you see when you open your computer; it's a desktop we designed with the necessary apps you need to connect to your machine).
localportal link my-machine
Executing this command displays the URL for your browser-based pseudo desktop or the dashboard, where you can see all the connected devices you have. It's important to note that you can run localportal in the background (or as a service), which is necessary if you are running it on a local or cloud server. This way, even if you close the terminal where you are running the command from, the service will continue to run in the background.
The URL obtained from the terminal, which is also available in the dashboard, is publicly accessible (but requires authentication) and allows you to access your machine's pseudo desktop from anywhere in the world, securely. This desktop offers numerous apps for accessing your machine, but we will specifically focus on the "expose port" app in this article.
The "expose port" app provides a convenient and powerful way to expose any ports on your machine, regardless of your physical location. You can access and manage these ports from anywhere in the world, ensuring that your workflow remains uninterrupted and efficient. One of the key features of this app is its ability to open multiple ports simultaneously. This capability is particularly useful when running several servers and applications that depend on each other or need to be accessed concurrently.
In addition to its port management capabilities, the "expose port" app also offers enhanced security measures. You can enable authentication for each exposed port, ensuring that only authorized users can access them. This added layer of protection helps maintain the integrity of your system and keeps your data secure, even when you're working remotely.
By leveraging the "expose port" app, you can effectively manage your machine's ports, run multiple servers and applications, and maintain a secure environment—all from the comfort of your own home or any other location around the globe.
Smart Routing
Localportal stands out as one of the few reverse tunneling services that incorporates smart routing. It ensures that the local port exposed from your local computer is directed through the nearest edge server, significantly enhancing speed. Our benchmarks confirm that Localportal consistently outperforms other services in terms of speed, including well-known alternatives like ngrok and Cloudflare.
Wrapping up
In summary, localportal makes opening up secure public access to your localhost web apps and services astonishingly easy. Its reverse tunneling approach handles all the complex networking and security configurations for you. With just a quick install and a single command to link to their cloud, you can start exposing local web servers, data science notebooks, model serving platforms, or any other localhost resources via generated URLs that can be safely shared. Whether you need to enable remote testing and feedback from team members around the world or just simplify accessing in-progress projects yourself across devices, localportal delivers with no firewall tweaking required. So if you code or experiment locally and have ever been frustrated with networking hurdles to sharing that work, give localportal's ingeniously simple tunnels a try.
Subscribe to my newsletter
Read articles from Boatbuilder directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Boatbuilder
Boatbuilder
AI engineer who has a background in security. Building micro SaaS focused on self hostable AI