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
- Stay on workers.dev — current state; zero setup, logged-out previews.
- 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.
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.
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 (crossSubDomainCookiesinapps/auth/src/auth.ts— required so the session covers bothuploads.shandauth.uploads.sh, since a cookieDomainattribute cannot enumerate hosts). Any preview hostname underuploads.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
previews_enabled: trueon anuploads.shpreview 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
apps/auth/src/auth.ts(deriveCookieDomain/crossSubDomainCookies)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.