Migrating from ngrok
tuna commands work almost the same way as ngrok's: ngrok http 8080 becomes tuna http 8080. Below is what changes in signing in, addresses, flags and the config file.
If ngrok stopped working in Russia with the ERR_NGROK_9040 error, everything you need to switch is on this page:
ERROR: authentication failed: We do not allow agents to connect to ngrok from your IP address (198.51.100.55).
ERROR: ERR_NGROK_9040
Installing and signing inβ
Install tuna by following the instructions and sign in:
tuna login
A browser opens, and once you confirm, the CLI stores the session in the system keyring. There's no authtoken in a config file.
| ngrok | tuna |
|---|---|
ngrok config add-authtoken <token> | tuna login |
NGROK_AUTHTOKEN | TUNA_API_KEY |
--authtoken | --api-key |
In CI, Docker and on servers without a browser, use an API key with "Run tunnels" enabled. See Sessions and API keys for details.
Commandsβ
| ngrok | tuna |
|---|---|
ngrok http 8080 | tuna http 8080 |
ngrok http file:///var/www | tuna http -f /var/www |
ngrok tcp 5432 | tuna tcp 5432 |
ngrok start web | tuna start web |
ngrok start --all | tuna start --all |
ngrok service install --config ngrok.yml | tuna service install -- tuna http 8080 |
ngrok update | tuna update |
For databases and SSH, tuna has dedicated commands with a protocol-aware inspector: tuna postgres, tuna mysql, tuna redis, tuna ssh. tuna tcp works for any TCP service.
Addressesβ
| ngrok | tuna |
|---|---|
| Random address | Dynamic address in the a.2na.am zone |
| Free static domain | Free permanent subdomain in the a.tuna.free zone: --subdomain=<your-subdomain> |
--url https://myapp.ngrok.app | Reserved subdomain: --subdomain=myapp |
--url https://app.example.com | Custom domain: --domain=app.example.com |
ngrok tcp --url=1.tcp.ngrok.io:27210 3389 | Reserved port: tuna tcp 3389 --port=rdp |
TCP tunnels and reserved subdomains require a subscription; the free permanent subdomain is available on every plan.
On the free plan, browsers see a warning page in front of the tunnel, just as with ngrok. To keep it away from your frontend, send the tuna-skip-browser-warning header instead of ngrok-skip-browser-warning.
Add your own domain in the dashboard first and point it to us with a CNAME record. Step by step: Connecting your own domain.
There's no --region flag: you don't need to pick a region.
Access controlβ
ngrok has deprecated many of its access flags in favor of Traffic Policy. In tuna they're still flags:
| ngrok | tuna |
|---|---|
--basic-auth user:pass | --basic-auth=user:pass |
--cidr-allow, --cidr-deny | --cidr-allow, --cidr-deny |
--ua-filter-allow, --ua-filter-deny | --ua-allow, --ua-deny |
--verify-webhook, --verify-webhook-secret | --verify-webhook, --verify-webhook-secret |
--request-header-add | --request-header |
--response-header-add | --response-header |
--oauth, --oidc | Apps: SSO sign-in in front of the service |
--traffic-policy-file | --policy-file |
tuna traffic policies are similar to Traffic Policy: a rule consists of expressions and actions β basic_auth, restrict_ips, rate_limit, redirect, url_rewrite, add_headers, custom_response and others. The expression syntax and action names differ, so you'll have to rewrite your policy file.
Config fileβ
ngrok.yml describes the agent and a list of endpoints. In tuna, this is split into two files:
- the global
tuna.ymlstores the API key and proxy settings; its location is on the Configuration File page; .tuna.ymlin the project root describes tunnels and traffic policies, and you can commit it to the repository.
Before, in ngrok.yml:
version: 3
agent:
authtoken: <token>
endpoints:
- name: web
url: https://web.ngrok.app
upstream:
url: 3000
- name: db
url: tcp://1.tcp.ngrok.io:27210
upstream:
url: 5432
After, in .tuna.yml:
tunnels:
web:
commandLine: tuna http 3000 --subdomain=web
db:
commandLine: tuna tcp 5432 --port=db
Start them with tuna start web or tuna start --all. You can tag tunnels and start them as a group; see Multiple Tunnel Startup for details.
Inspectorβ
The Request Inspector also opens at http://127.0.0.1:4040; further tunnels get 4041, 4042 and so on. Request replay is there too.
| ngrok | tuna |
|---|---|
--inspect=false | --inspect=false |
web_addr: 127.0.0.1:4100 | --inspect-port=4100 |
Besides HTTP, the inspector shows queries to PostgreSQL, MySQL and Redis.
Running in the background and Dockerβ
ngrok service install runs all the tunnels from the config. In tuna, each service runs one tunnel command and has its own name:
tuna service install --name=web -- tuna http 3000 --subdomain=web
tuna service install --name=db -- tuna tcp 5432 --port=db
The Docker image is yuccastream/tuna; the container arguments are the tuna command:
docker run -d --network host -e TUNA_API_KEY=<your_key> yuccastream/tuna http 3000
See Containers for details.
If you started tunnels from code with the ngrok SDK, tuna has SDKs for Go, Node.js, Python, Java, .NET, PHP, Ruby and Rust.
What tuna doesn't haveβ
- There's no equivalent of
ngrok tls: tuna doesn't route TLS traffic by hostname without decrypting it. If your service has to hold the certificate itself, usetuna tcpβ the address will include a port. - Neither ngrok nor tuna supports UDP.
Next stepsβ
- HTTP tunnel: all flags and examples.
- Error catalog: what a CLI message means and how to fix it.
- Pricing: what's free and what needs a subscription.