TL;DR
Reverse proxy solutions are a great and straightforward method to expose your dev (and possibly production) server to the internet. The two prominent ones are ngrok and Cloudflare tunnels. This article recommends both of them and compares and contrasts them on a high level.
Introduction
As mentioned in my previous article, one can monitor their server using one of many solutions, and in order to expose your web or home server without opening a port on your firewall and possibly having to configure a static public IP, you need to use a reverse proxy solution to solve that problem. The two most reliable ones in the market at the time of writing this article are ngrok
and Cloudflare Tunnels
.
ngrok
Ngrok is the one that pops up the most in YouTube videos and online articles since it quite easy to setup and get up and running. The steps can be found here which include running a simple web server, installing ngrok, configuring the auth token, and running the reverse proxy agent.
Cloudflare tunnels
To run the cloudflared
tunnel agent and have one up and running, you need to follow these steps:
- Create an account with Cloudflare by going to their website here and choosing the free plan.
- Fill up the information needed, which are an email address and a password at the time of writing this article.
- It will then take you to their dashboard where you need to do two things, register, link, or transfer a domain, and then create a tunnel in their Zero Trust dashboard. The screenshots below explain the steps.
3.2 Cloudflare dashboard w/ ZeroTrust
tab
3.3 Cloudflare tunnel creation steps
Note: The cloudflared
client is easy to install yet its installation steps are different based on your operating system.
My biased thoughts on the two solutions
As stated earlier, both solutions are reliable and they work well.
My preference is to use ngrok for dev servers, homelabs, and staging environments. Also, the nice thing about ngrok
it is the fact that it offers subdomains and can work instantly. Also, subdomains are available so you don't have to purchase and maintain one if it's not a requirement.
Cloudflare
, on the other hand, is more useful in production since it has more servers around the world and has more security configurations. But you need a domain name to use it (though easily offered by them).
Final Note
No matter whether you need to expose a server, use ssh or RDP, or if you have any other use case, those reverse proxy solutions can certainly be of benefit to you. Choose the one that best suits your needs and proceed with it.
Happy building!
Top comments (1)
Great article, thank you, Amjad. I was looking for alternatives to ngrok since their tunnels don't remain open on their free tier for the functionality I needed to run a few tests. True, their services are quite spectacular and they have been in the field "forever", so "horses-for-courses" are a solid bet. I'm a Cloudflare user and was unaware they had a tunnel offer. Great to see they might be what I need, although from reading here quickly, even though my domain runs on their platform, testing for other projects might not be as simple. I'll have to go see what I might achieve by using a temporary sub-domain route.
I also discovered SocketXP, which looks like a good way to go for running tests to evaluate connecting devices via HTTP tunnels. However, their full-functionality, free trial is only valid for 30 days.
It seems Cloudflare is a great way to go. Their documentation is good and one can even use their WARP VPN option to route the tunnel through as well.