Custom domains
A custom domain puts your own hostname, such as api.example.com, in front of a tunnel. It carries no traffic and orders no certificate until DNS shows that you control it.
Add a domain
From the agent, give the tunnel a name and the domain:
tunl http 3000 --name shop --domain api.example.com
tunl tls 8443 --name app --domain app.example.com
--domain can be repeated. In tunl.yml write domain: api.example.com or a list under domains:. A raw tcp tunnel cannot use a domain: nothing in a TCP connection names the host.
From the panel, open Domains, type the domain and, as the operator, the tunnel name. The API is POST /api/domains with {"host": "api.example.com", "tunnel": "shop"}.
Prove ownership
Add one of these records at your DNS provider. The panel shows both with a copy button.
api.example.com CNAME shop.tunl.surf
_tunl-verify.api.example.com TXT "tunl-verify=<token>"
The CNAME also sends the traffic here. Use the TXT record for an apex domain (which cannot hold a CNAME) or when the record is proxied by Cloudflare, which hides the CNAME. Then press Verify DNS (POST /api/domains/{host}/verify). DNS changes can take a few minutes; the check can be repeated twelve times a minute.
The server token binds a domain at once, without a DNS check, because the operator vouches for it. A member account proves DNS first; when a member's agent starts with --domain, the check runs during the connection and the agent stops with the exact record to add if it fails.
Bound while the tunnel runs
A verified domain is routed to the open tunnel immediately; the agent does not reconnect. Removing the domain stops its traffic at once. While the agent is away, the domain answers 503, like a reserved name. Releasing the tunnel name removes its domains too.
HTTPS
With --acme-email, the certificate for a verified domain of an HTTP tunnel is ordered from Let's Encrypt on the first HTTPS request and renewed before it expires. Pending domains, raw TCP and TLS passthrough tunnels never order one, so a stranger cannot spend the weekly limit. A tls tunnel passes the encrypted connection to your app, which presents its own certificate. Behind a reverse proxy (--public-url https://…), the proxy holds the certificate.
Limits and rules
- A member account adds up to five domains, set with
aditd --max-domains-per-member. The operator is not limited. - Wildcards, IP addresses,
localhost,.local,.internal,.onionand the server's own domain are refused. Subdomains of the server's domain are given with--name. - A domain belongs to one tunnel name. Another tunnel asking for it is refused.
- The table is kept in
adit-domains.jsonbeside the data file./metricsreportsadit_custom_domains_totalandadit_custom_domain_verifications_total.