Skip to content
Toolkit

ADR-0169 — A public resource is found by its host and its slug

Status: Accepted · Date: 2026-10-11 · Track: launch wave 1, api workstream · Builds on: the redirect path's host resolution (requestDomainIDFor), the gate's host parameter (ADR-0092)

Context

The Overview promises yourdomain.com/slug and yourdomain.com/@slug. The redirect path (/l/{url}) has resolved by host since 2026-08-03. The five public JSON doors did not: bio page, vCard, event, payment and card all called GetLinkByURL(slug, 0). The redirect path then handed custom-domain visitors to APP_URL/<prefix>/<slug>, where the app fetched the default domain's resource of the same slug, or nothing (launch audit P1-3). No endpoint let a TLS terminator decide whether to issue a certificate for a customer domain, so SSL was a manual step.

Decision

  1. Every public door resolves by (host, slug). publicDomainID(r, domains) takes the host from the host query parameter when present, otherwise from the request's Host, and maps it to an enabled domain through requestDomainIDFor, the same function the redirect and the gate use. An unknown host is the default domain.

  2. The hand-off carries the host. When the redirect path sends a visitor from a custom-domain resource to the app (/vc/, /ev/, /pay/), it adds host=<domain>, so the app's fetch finds the same resource. The gate already did this.

  3. Bare addresses are served on the API (/{slug}, /{slug}/*, ADR-0170), so a custom domain whose traffic goes to the API serves yourdomain.com/slug directly. /@{slug} was already an API route and now resolves by host.

  4. On-demand TLS ask: GET /internal/tls/ask?domain=<name> answers 200 only for a domain that is enabled and verified (is_verified), 404 for any other name, 400 for a malformed one, and 503 on a lookup error. It never answers yes on an error. Caddy:

    {
        on_demand_tls {
            ask http://127.0.0.1:18810/internal/tls/ask
        }
    }
    https:// {
        tls { on_demand }
        reverse_proxy 127.0.0.1:18810
    }
    

    The web server never forwards /internal/, and the API listens on loopback in the documented topology.

Consequences

  • A host naming another customer's domain reaches only what is already public at that domain's own address.
  • Routing uses enabled. Certificates also need verified, because the is_verified backlog (DEFERRED 007 B1) means some rows may be marked verified by the old no-op. The operator should re-verify them before turning on on-demand TLS.
  • The Caddy and deploy changes belong to infra (hand-off Requests).

Source: docs/decisions/0169-a-public-resource-is-found-by-its-host-and-its-slug.md

Library