Skip to content

Commit c22a54b

Browse files
btouchardclaude
andcommitted
fix(status): keep browser URL on status subdomain root without /status redirect
Previously the injected urlFixScript called history.replaceState to rewrite "/" to "/status", which visibly changed the address bar to /status when visiting the dedicated status subdomain. Replace the rewrite with a window flag and mount PublicStatusPage at "/" in the Vue router when the flag is set, so the URL stays at the subdomain root. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6c6617d commit c22a54b

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

frontend/src/router/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,20 @@ const NodesPage = () => import('../pages/NodesPage.vue')
3535
const EscalationPage = () => import('../pages/EscalationPage.vue')
3636
const ChannelsPage = () => import('../pages/ChannelsPage.vue')
3737

38+
const isStatusSubdomain = (window as unknown as { __MAINTENANT_STATUS?: boolean }).__MAINTENANT_STATUS === true
39+
3840
const router = createRouter({
3941
history: createWebHistory(import.meta.env.BASE_URL),
4042
routes: [
43+
...(isStatusSubdomain
44+
? [
45+
{
46+
path: '/',
47+
component: PublicLayout,
48+
children: [{ path: '', name: 'status-public', component: PublicStatusPage }],
49+
},
50+
]
51+
: []),
4152
{
4253
path: '/',
4354
component: DefaultLayout,
@@ -68,7 +79,7 @@ const router = createRouter({
6879
{
6980
path: '/status',
7081
component: PublicLayout,
71-
children: [{ path: '', name: 'status-public', component: PublicStatusPage }],
82+
children: [{ path: '', name: isStatusSubdomain ? 'status-public-admin' : 'status-public', component: PublicStatusPage }],
7283
},
7384
],
7485
})

internal/status/handler.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ func (h *Handler) Register(mux *http.ServeMux, mw Middleware) {
7979
}
8080
}
8181

82-
// urlFixScript runs before Vue initialises and rewrites "/" to "/status" so that
83-
// Vue Router renders PublicStatusPage when the status subdomain is accessed at root
84-
// (Traefik replacepathregex rewrites "/" → "/status/" at the backend level, but the
85-
// browser URL stays at "/", so Vue Router needs a nudge).
86-
const urlFixScript = `<script>if(window.location.pathname==='/'){history.replaceState({},'','/status')}</script>`
82+
const urlFixScript = `<script>window.__MAINTENANT_STATUS=true</script>`
8783

8884
// HandleStatusPage serves the Vue SPA index.html for the /status/ path.
8985
// A small inline script is injected so that Vue Router initialises at /status when

0 commit comments

Comments
 (0)