Skip to content

Revisit custom domains + Access for Workers Previews #684

Description

@zachdunn

Follow-up to #683, which adopted Workers Previews on default workers.dev URLs.

Decision being revisited

Previews currently live at <name>-<worker>.buildinternet.workers.dev. We deliberately did not enable custom preview domains, because our session cookies are .uploads.sh-scoped (crossSubDomainCookies in apps/auth/src/auth.ts — required so the session covers both uploads.sh and auth.uploads.sh, since a cookie Domain attribute cannot enumerate hosts). Any preview hostname under uploads.sh — including a dedicated *.previews.uploads.sh — therefore receives real production session cookies from signed-in visitors, i.e. unreviewed branch code sees live sessions. With many branches agent-authored, a prompt-injected branch could exfiltrate an admin session from anyone who clicks its preview link. workers.dev URLs sit outside the cookie scope, so previews are cleanly logged-out.

Options when revisiting

  1. Stay on workers.dev — current state; zero setup, logged-out previews.
  2. Dedicated separate zone for previews (e.g. one of the parked domains) — same logged-out security, prettier stable URLs via a wildcard on a zone outside the cookie scope. Aesthetics only.
  3. previews_enabled: true on an uploads.sh preview hostname + Cloudflare Access — signed-in preview review out of the box, accepting the cookie exposure above. Access gates who can reach previews but not what branch code sees once a signed-in visitor arrives. Would pair with a norm of only visiting previews of skimmed branches. Note the docs recommend a dedicated preview subdomain when the apex has real subdomains (ours: api./auth./agents./mcp.), since enabling provisions a wildcard DNS record + cert.

References

Trigger to revisit

Signed-in shareable preview links becoming a real need (today the local portless stack covers signed-in review), or workers.dev URLs proving unworkable for sharing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions