Skip to main content

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.

ngroktuna
ngrok config add-authtoken <token>tuna login
NGROK_AUTHTOKENTUNA_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​

ngroktuna
ngrok http 8080tuna http 8080
ngrok http file:///var/wwwtuna http -f /var/www
ngrok tcp 5432tuna tcp 5432
ngrok start webtuna start web
ngrok start --alltuna start --all
ngrok service install --config ngrok.ymltuna service install -- tuna http 8080
ngrok updatetuna 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​

ngroktuna
Random addressDynamic address in the a.2na.am zone
Free static domainFree permanent subdomain in the a.tuna.free zone: --subdomain=<your-subdomain>
--url https://myapp.ngrok.appReserved subdomain: --subdomain=myapp
--url https://app.example.comCustom domain: --domain=app.example.com
ngrok tcp --url=1.tcp.ngrok.io:27210 3389Reserved 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:

ngroktuna
--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, --oidcApps: 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.yml stores the API key and proxy settings; its location is on the Configuration File page;
  • .tuna.yml in the project root describes tunnels and traffic policies, and you can commit it to the repository.

Before, in ngrok.yml:

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:

.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.

ngroktuna
--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, use tuna tcp β€” the address will include a port.
  • Neither ngrok nor tuna supports UDP.

Next steps​