Commit 914aaa9
fix(cli): redirect Console on a bare/reserved platform host to the cloud console (#2355)
`objectstack serve`/`dev` serves the Console SPA on ANY host, but a bare/reserved
platform host (the apex, or `www`/`app`/… — none bind a tenant env) has no env, so
its `/api/v1/auth/*` calls 404 → the login renders the misleading "Auth request
failed with status 404" dead form. The unknown-hostname guard already passed these
reserved hosts straight through (RESERVED includes the empty/apex subdomain), so
the SPA loaded and broke.
Fix: in the guard, when a reserved/apex platform host receives a `/_console*`
request AND the runtime is cloud-connected (`OS_CLOUD_URL` set), 302 it to the
cloud control plane (`OS_CLOUD_URL` + `/_console/`), where the user picks/opens an
environment. A self-hosted single-env runtime (no `OS_CLOUD_URL`) keeps the prior
pass-through, and non-console paths (infra, health, /api) are unchanged. A real env
host resolves to a tenant and is served normally.
Mirrors the same cleanup on the cloud serve-node path (objectos `server/index.ts`),
which was verified live: bare `/_console/login` → 302 → cloud console; `/api/v1/auth/*`
still 404; env host /_console → 200. cli build green (DTS typecheck clean).
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent b590d1f commit 914aaa9
1 file changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
859 | 859 | | |
860 | 860 | | |
861 | 861 | | |
862 | | - | |
863 | 862 | | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
864 | 879 | | |
865 | 880 | | |
866 | 881 | | |
| |||
0 commit comments