Repository navigation
Description
Goal
Split the website surface across two custom domains on one Astro codebase so the session cookie stays host-only and never attaches to public subdomains.
nemar.org— public marketing surface (anonymous, cacheable).app.nemar.org— authenticated surface (cookies, no edge cache).
Decision context lives in .context/handoff-auth-backend.md on the local feature/auth-backend-pending branch.
Why
A cookie scoped to .nemar.org attaches to every request to api.nemar.org, data.nemar.org, docs.nemar.org, and any future discuss.nemar.org. That is wasteful (every byte-range raw.set fetch carries it) and widens the blast radius of any subdomain compromise. Host-only cookie on app.nemar.org solves it.
This must be applied before the backend (nemarOrg/nemar-cli#569) issues its first prod cookie, because changing cookie domain later logs everyone out.
Surface allocation
app.nemar.org (authenticated):
/login,/login/verify,/login/pending/welcome/dashboard/upload,/upload/success/admin/*/settings/dataset/[id]/collaborators/api/auth/*,/api/admin/*proxies
nemar.org (marketing):
/,/about,/support,/community,/citation-dashboard/discover/dataset/[id](not/collaborators)/docs/*/signup(CLI-deferral page)- 404
Acceptance
- Middleware reads
Astro.url.hostnameand 301-redirects mismatches across the two production hosts. - On
nemar.org, middleware never calls/auth/meand never setsAstro.locals.session. - Marketing nav shows no UserMenu; "Sign in" link points at
https://app.nemar.org/login. - App nav shows UserMenu + "Explore datasets" link to
https://nemar.org/discover. -
*.pages.devpreviews andlocalhostkeep current single-host behavior so QA stays cheap. -
src/middleware.test.tscovers both redirect directions and the single-host passthrough. - Custom domain
app.nemar.orgis added to the Cloudflare Pages project (documented in AGENTS.md; manual dashboard step). - Backend contract in
.context/handoff-auth-backend.mdcross-checked againstnemar-cli#569work-in-progress so cookieDomain=app.nemar.orgis set there (not.nemar.org).
Out of scope
- The
nemar-cli#569backend itself. - Forum /
/discusssurface — separate future decision. - Splitting into two Pages projects (single project, two custom domains is the v1).
Activity
Merge pull request #48 from nemarOrg/feature/issue-47-app-subdomain-s…