Migrating from Cloudflare Tunnel
With Cloudflare Tunnel, you first create a tunnel, look up its UUID, write a config.yml with ingress rules and add a DNS record with a separate command. tuna has no UUIDs and no credentials files, and our subdomains don't need DNS records. A tunnel is a single command with a port and an address.
Installing and signing inβ
Install tuna by following the instructions and sign in:
tuna login
| cloudflared | tuna |
|---|---|
cloudflared tunnel login | tuna login |
cloudflared tunnel run --token <token> | TUNA_API_KEY=<key> tuna http 8080 |
TUNNEL_TOKEN | TUNA_API_KEY |
On servers, in CI and in Docker, use an API key with "Run tunnels" enabled instead of signing in through a browser. See Sessions and API keys for details.
Quick tunnelβ
| cloudflared | tuna |
|---|---|
cloudflared tunnel --url http://localhost:8080 | tuna http 8080 |
As with a quick tunnel, the address is dynamic and changes when you reconnect. To keep it stable, use your free permanent subdomain β every account has one:
tuna http 8080 --subdomain=<your-subdomain>
Server-sent events and WebSocket work with no extra setup.
Tunnel on your own domainβ
Cloudflare needs the whole domain added to Cloudflare. tuna needs only a CNAME record at your DNS provider:
- Add the domain in the dashboard and create the CNAME record it shows. Step by step: Connecting your own domain.
- Start the tunnel:
tuna http 80 --domain=app.example.com
| cloudflared | tuna |
|---|---|
cloudflared tunnel create app | not needed |
cloudflared tunnel route dns app app.example.com | a CNAME record at your DNS provider, once |
cloudflared tunnel run app | tuna http 80 --domain=app.example.com |
Several services: config.ymlβ
Each ingress rule pairs an address with a local service. In tuna, that's a tunnel in a .tuna.yml file in the project directory. You don't need the http_status:404 catch-all rule at the end.
Before, in ~/.cloudflared/config.yml:
tunnel: <UUID>
credentials-file: /root/.cloudflared/<UUID>.json
ingress:
- hostname: app.example.com
service: http://localhost:8000
- hostname: api.example.com
service: http://localhost:9000
- service: http_status:404
After, in .tuna.yml:
tunnels:
app:
commandLine: tuna http 8000 --domain=app.example.com
api:
commandLine: tuna http 9000 --domain=api.example.com
Start them all with tuna start --all, or one with tuna start app. See Multiple Tunnel Startup for details.
SSH, databases and other TCP servicesβ
With Cloudflare Tunnel, whoever connects to an ssh:// or tcp:// service usually has to install cloudflared or a Cloudflare client. In tuna, a TCP tunnel gets a public address with a port, and any regular client can connect:
tuna tcp 5432
psql -h a.2na.am -p <port> -U postgres
| cloudflared | tuna |
|---|---|
service: ssh://localhost:22 | tuna ssh β a built-in SSH server β or tuna tcp 22 |
service: tcp://localhost:5432 | tuna postgres 5432 or tuna tcp 5432 |
service: unix:/path/to.sock | tuna http unix:///path/to.sock |
For a permanent address, use a reserved port, for example tuna tcp 5432 --port=db. TCP tunnels require a subscription.
Access controlβ
Cloudflare restricts access with a separate product, Cloudflare Access, and modifies requests with Workers. In tuna, basic protection is set with tunnel flags, and SSO sign-in lives in Apps:
| Cloudflare | tuna |
|---|---|
| Access: SSO or email sign-in | Apps |
--allowed-mail on a quick tunnel | Apps or --basic-auth |
| IP access rules | --cidr-allow, --cidr-deny |
| Workers: headers, redirects, URL rewrites | Traffic Policies |
Running in the background and Dockerβ
cloudflared service install sets up a service that keeps the tunnel running after a reboot. In tuna, a service runs one tunnel command:
tuna service install --name=app -- tuna http 8000 --domain=app.example.com
The Docker image is yuccastream/tuna:
docker run -d --network host -e TUNA_API_KEY=<your_key> yuccastream/tuna http 8000
See Running in the background and Containers for details.
Next stepsβ
- HTTP tunnel: all flags and examples.
- Request Inspector: tunnel requests at
http://127.0.0.1:4040, with replay. - Pricing: what's free and what needs a subscription.