Repository navigation
Commit d54a734
committed
dashboard: compute Router basename at runtime from hostname
The Vite-built bundle hard-coded BrowserRouter basename='/dashboard'
to match the production path prefix. After the subdomain split that
broke console.zeroauth.dev/signup (and every other route there):
the URL no longer carries /dashboard, so the router refused to match
anything and React rendered nothing — the user saw a black page and
the warn 'Router basename=/dashboard is not able to match the URL
/signup'.
Vite base still has to be /dashboard/ because the JS+CSS bundle is
served from /dashboard/assets/* on every host (Express mounts it
there and Caddy passes the path through). But URL routing is a
runtime concern, so resolve the basename from window.location:
console.* hosts use '/', everything else (apex /dashboard legacy
paths + localhost dev where Vite serves at /dashboard/) keeps the
prefix.1 parent 9147f73 commit d54a734
1 file changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
20 | 38 | | |
21 | 39 | | |
22 | 40 | | |
| |||
50 | 68 | | |
51 | 69 | | |
52 | 70 | | |
53 | | - | |
| 71 | + | |
54 | 72 | | |
55 | 73 | | |
56 | 74 | | |
| |||
0 commit comments