~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

No way to serve a group's site at a domain of its own

Open
Open chadtmiller.com opened this issue 0 comments

What happened

A group can take a handle on a domain it owns (updateGroupHandle), but there is no way to serve its site at that domain. Worse, taking such a handle stops the site answering at the group's address, because sites::site_of matches a request only by the group's current handle (crates/group-host/src/sites.rs:227-228). The deployment's proxy can't route the new domain, so the site goes dark and nothing tells the steward.

Claude Opus 5.5

Where it stands

  • site_of looks the request's Host up with store.account(), which matches a DID or a handle (store.rs:904), and serves only when account.handle == name. Once a group's handle is riders.org, a request to riders.groups.example.com matches nothing and falls through to the host's other routes.
  • In code, a request to riders.org would now be served the site. In practice it never arrives: docs/deploying.md routes and certifies only *.groups.example.com.
  • docs/design/sites.md says the site is served "at the group's handle". docs/design/groups.md says the address "stays reserved" after an own-domain handle, but not what is served there.
  • opensocial (the TypeScript host) made the other choice in 0fc4f5f2: the site lives at groups.address, which never changes, and an own-domain handle changes only the group's name. It has no way to serve the site at the domain either. Its only option is a 302 from / to profile.url, for a site hosted somewhere else.

Proposal

1. The address always serves the site (a fix, independent of the rest)

site_of matches the group's address as well as its handle, so an own-domain handle no longer takes the site down. The address never changes and stays the group's home. sites.md says so.

2. The site's domain comes from the handle

A group may serve its site at its own-domain handle or at a name under it (riders.org, www.riders.org), never at an unrelated domain.

  • No new proof. The handle's _atproto TXT record already shows the group controls the zone, and www is under it.
  • No new check. When the handle stops naming the group, or the group goes back to its address, the site domain is dropped with it.
  • www is allowed because a bare riders.org can't take a CNAME, and many DNS providers make that awkward.
  • Cost: a group whose handle is its address can't have a custom site domain. It takes the domain as its handle first.

It is one setting on the group. One method sets it and --undo clears it, for group.configure. The command and MCP tool come from one TOOLS entry, with rows in cli.md and mcp.md. The console's handle settings show the one DNS record to add: a CNAME to a target the host publishes (sites.<host>), or an A/AAAA record or ALIAS/ANAME/flattening for a bare domain.

3. Requests by Host

  • site_of matches the address, the handle, or the site domain.
  • Pages asked of the address redirect with a 301 to the site domain once it is set.
  • /.well-known/ stays the host's on every name, so atproto-did keeps answering at a domain that is both handle and site.
  • Keep the Content-Security-Policy: sandbox everywhere. On its own registrable domain, the site no longer shares cookies with the console, but any app holding group.configure can still write the site record.

4. TLS and the proxy (docs/deploying.md)

The wildcard certificate can't cover arbitrary domains:

  • Caddy issues certificates as each domain first connects: on_demand_tls { ask https://<host>/... }, with a catch-all :443 block that passes the Host header to the host.
  • The host's ask endpoint answers 200 only for an active group's current site domain. Otherwise anyone could point DNS at the host and use up its Let's Encrypt limits.
  • The wildcard certificate stays for the handle domain.
  • Cloudflare for SaaS would also work, but it ties operators to one vendor, while Caddy is already the documented proxy.

5. Lifecycle

  • Switching off or deleting a group stops serving its site domain and refuses ask.
  • A move carries the site domain in the snapshot. The new host serves it only once DNS points there, so the owner repoints the CNAME, unlike a handle, which follows its TXT record. The handle settings on the new host say so.

Not doing

  • An unrelated site domain with its own TXT proof: a second check flow for a rare case.
  • For opensocial, moving the members' app to the custom domain: its site is an OAuth client tied to its origin, and MCP tokens are tied to https://<address>/mcp. Moving them means every member signs in again and every connected AI app breaks. There the custom domain should serve only the public pages and /join, leaving /c, /_oauth, /mcp and client-metadata.json at the address. This host's sites are static files, so all of a site can be served on both names.

Order

  1. site_of matches the address, with a test that the site answers there after updateGroupHandle, and sites.md.
  2. The site-domain setting, its method, command, tool, lexicon and console line.
  3. Routing by site domain, the address redirect, and the ask endpoint.
  4. docs/deploying.md: the on-demand TLS block and the CNAME target.