I built OpenTunnel after getting tired of paying for custom subdomains on tunnel services. It's a self-hosted alternative that gives you full control, free WAF, and works with any domain you own.

Picture this: It's Friday night. You want to show your friends the Minecraft server you've been hosting on your Raspberry Pi. You try to share your IP... but it's a CG-NAT address. No port forwarding for you.
You spin up ngrok. Cool, you get a URL like https://random-string.ngrok-free.app. Works, but:
You think: "This can't be that hard to solve."
You were right.
Services like ngrok charge premium prices for custom subdomains because... they can. The technology itself isn't complex:
*.ngrok.ioThe expensive part is maintaining infrastructure, scaling, and offering SLAs. But for personal use? You can do this on a $5/month VPS.
I wanted something that:
mine.tunnel.op.yourdomain.com)So I built it.
OpenTunnel is a self-hosted tunnel system that gives you the best of all worlds:
Why limit yourself to one tunnel provider? OpenTunnel abstracts them all:
# Use your own server
opentunnel quick 3000 -s yourdomain.com
# Or Cloudflare Tunnel (free, no account needed)
opentunnel http 3000 --cloudflare
# Or ngrok
opentunnel http 3000 --ngrok
# All from the same CLI
Most tunnel services offer basic IP blocking. OpenTunnel goes further:
Standard HTTP tunnels buffer responses. That breaks video streams and large file transfers.
OpenTunnel's streaming mode streams byte-by-byte:
# 10-minute timeout (good for most video streams)
opentunnel http 8080 --streaming
# Custom timeout (e.g., 30 minutes)
opentunnel http 8080 --timeout 1800000
# No timeout (dangerous but sometimes necessary)
opentunnel http 8080 --timeout 0
When you run in server mode, OpenTunnel:
No manual nginx wizardry required.
I built this primarily to share my home server without exposing my home IP. My setup:
tunnel.op.mydomain.comminecraft.tunnel.op.mydomain.comNo port forwarding on my router. No direct IP exposure. Clean URLs.
Need to show a client a dev environment? One command:
opentunnel quick 3000 -s yourdomain.com -n client-project
# → https://client-project.tunnel.op.yourdomain.com
They get a branded URL. No explaining why it says "ngrok-free.app."
For production, you want:
OpenTunnel supports all of this. The difference from ngrok is you control the infrastructure.
┌─────────────────────────────────────────┐
│ INTERNET │
│ Users → https://app.tunnel.op.example.com
└───────────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ OpenTunnel Server │
│ - Subdomain routing │
│ - nginx reverse proxy │
│ - WebSocket transport │
│ - WAF (IP/UA filtering) │
└───────────────────┬─────────────────────┘
│ WebSocket
▼
┌─────────────────────────────────────────┐
│ Your Computer/Home Lab │
│ - Services behind NAT │
│ - Minecraft, web apps, APIs │
└─────────────────────────────────────────┘
The server listens on port 443, your local service connects via WebSocket, and nginx routes based on subdomain. Simple, reliable, maintainable.
npm install -g opentunnel-cli
# Point *.tunnel.op.yourdomain.com to your VPS IP first
sudo opentunnel server -d --domain yourdomain.com --letsencrypt --email [email protected]
opentunnel quick 3000 -s yourdomain.com -n myapp
# → https://myapp.tunnel.op.yourdomain.com
# With Cloudflare (free, no account)
opentunnel http 3000 --cloudflare
# With ngrok (but unified CLI)
opentunnel http 3000 --ngrok --token YOUR_TOKEN
OpenTunnel uses tunnel.op as a reserved subdomain prefix. This keeps your main domain free for normal use.
Configure your DNS:
tunnel.op.yourdomain.com pointing to your VPS IP*.tunnel.op.yourdomain.comThis separates tunnel traffic from your regular website.
OpenTunnel is production-ready for my use cases, but there's always more to build:
Check the GitHub repo for updates.
I got tired of paying monthly fees for a feature that's technically trivial. The real cost of services like ngrok isn't the technology—it's the convenience and infrastructure maintenance.
If you're comfortable with a VPS and want full control, OpenTunnel is for you. If you just need a quick tunnel and don't care about custom domains, ngrok's free tier is fine.
The point is: you have options. Building your own tools is always worth it, even if it's just to understand what you're actually paying for.
Live demo: https://github.com/FJRG2007/opentunnel
Try it. Break it. Tell me what's missing.
Learn more about my work and projects!