http tunneling for localhost's website
ngrok, localtonet, expose, cloudflared
3 min read
To get a website in-development checked by a colleague or someone else like a client or another developer or tester, one would normally upload the entire website to a test server with a test domain name with the database recreated / replicated on the test server - its as good as double work for development consuming real server resources (however low the resources maybe) which would be additional costs just for testing.
But if one could show his / hers laptop's localhost directly to the other person then it would save tremendous time and lower the costs drastically. There are ways to get this done - called tunneling.
Here are four tunneling solutions that are worth checking out.
ngrok - ngrok.com
- Fastest to setup and run
- Minimal logs
- Easy to understand display on terminal
- No package file like .msi or .dmg or .deb to setup - the zip contains just the executable which we need to just run as
./ngrok http 8000
- Has freemium with resource limits and 2 hours limit for anonymous connections
- Paid plans @ $240 a year allows custom domains and OAuth among other features
localtonet - localtonet.com
- Has two way communication between the web control-panel and the executable that you need to run in the terminal. Even after running the tool in the terminal (
./localtonet) giving the AuthToken code which you get in the control panel, I still had to click start in the control panel to get it running. Don't know why double the work.
- Freemium plan has a 20 minute timeout which is not that bad unless the person at the other end checks back in every 30 mins, but the good news is that the paid plan is at $12 a year.
- Good for students and collaborating personal projects with your friends.
- Some ISPs may block the localtonet server IPs
expose - expose.dev
This is an open-source ngrok alternative - written in PHP but the website expose.dev which has the paid service is blocked by CloudFlare in countries such as India, so couldn't check this out. I am not writing about how to deploy the open-source tool on your system - that's for another day
Cloudflare Tunnel - developers.cloudflare.com/cloudflare-one/co..
- By CloudFlare ! Everyone knows the reputed CloudFlare company
- Single command to run as
cloudflared tunnel --url http://localhost:8000
- Way too many of logs printed on running the command
- Couldn't see an option of using custom domains
- They're making some changes - You should migrate all existing legacy tunnels to Named Tunnels by October 1, 2022
If you're serious about business and have $ paying clients, then ngrok is the best solution, hands down - even if it's $25 / month (or $20 / month paid annually).
Further Reading - github.com/anderspitman/awesome-tunneling