Skip to content

For agents: a custom domain

This is one of the task pages for coding agents. Instructions for coding agents comes first; read it if you have not.

  • The app is deployed and serves at its tori.cloud address.
  • The person wants it at a hostname they already own, and can change that name’s DNS records.

Do not add a hostname the person did not name. After a first successful deploy you may offer it once, in one sentence, and leave it there if they do not take it up.

It does not apply to buying a name. Domain sales are a preview and are not available on api.tori.host; Buying a domain is the page for that, and a purchase is the person’s to make.

  1. Reserve the hostname. From the directory that holds tori.json (or name the app: domains add <slug> <hostname>):

    Terminal window
    npx tori.host domains add www.example.com

    With MCP, that is tori_domains_add. The answer is what to create in DNS, and it is one of two things:

    • A CNAME record to the app’s tori.cloud name, for a subdomain. The answer may also name an A record with a TXT record. That is the other way to do it, not something to add: a CNAME cannot stand beside another record at the same name. Use it only if the subdomain is a delegated zone of its own (it has NS records), where DNS allows no CNAME.
    • An A record and a TXT record, for an apex such as example.com and for a delegated subdomain. The A record points to the zone’s addresses, and the TXT record proves the name is the person’s. Without the TXT record it never becomes active.
  2. Hand the records of that one way to the person, exactly as printed: the CNAME alone, or the A and the TXT both. Creating them at their DNS provider is their step, unless they have given you a tool for that provider and asked you to use it. Create only what was printed, and only after step 1: a hostname pointed at Tori before it is reserved is not connected to anything.

  3. Check. DNS takes time, and the certificate is issued only after the record resolves.

    Terminal window
    npx tori.host domains check www.example.com
    npx tori.host domains list --json

    check re-runs the DNS check at most once every 30 seconds, so do not loop on it faster than that. With MCP, read the state with tori_domains_list.

domains list reports the hostname as active, and a request to https://www.example.com/ is answered by the app with a valid certificate. Those are two facts; report each as you found it.

Until then, say which state the hostname is in, not that it is connected:

State What to say
pending-dns The record is not seen yet. If the answer says what it saw instead, pass that on: it is usually a typo in the record.
verified, issuing DNS is right and the certificate is being obtained. Nothing for the person to do.
failed Pass on the reason it gives, and the time it may be retried after if it names one. Do not send the person back to DNS unless the reason is about DNS.
active, and the request fails Find where it fails before you name a cause. The name no longer resolving to the record that was printed is a DNS change. A certificate error is TLS. Only an HTTP error that comes back over a valid certificate is the app’s.
  • Which hostname, and whether they mean the apex, www, or both. Each is added separately.
  • Before removing a hostname (npx tori.host domains remove). Its visitors stop reaching the app.
  • Before choosing a primary hostname or turning on redirects. Those are a preview and not generally available; One canonical hostname says what they do.

Custom hostnames depend on the plan. If the plan has none, domains add is refused and the message names the plan. Pass that on. Changing the plan is the person’s decision, and nothing here changes it for them.

Custom hostnames and tori domains have the details.