fix(vite): rewrite to <app>.html when query has dots (JWT tokens)

The dev SPA-fallback plugin used `!req.url.includes('.')` to skip asset
requests, which also matched JWT-shaped `?token=hdr.body.sig` query
strings — so `localhost:5185/?token=...` fell through to the hub
`index.html` instead of `market.html`, breaking the hub→standalone
auth-relay link. Strip the query before the extension check.

Applied to all 7 standalone vite configs.
This commit is contained in:
Padreug 2026-05-03 16:02:06 +02:00
commit a0187a6604
7 changed files with 30 additions and 9 deletions

View file

@ -11,12 +11,15 @@ function tasksHtmlPlugin(): Plugin {
name: 'tasks-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.')
!path.includes('.')
) {
req.url = '/tasks.html'
}