fredy icon indicating copy to clipboard operation
fredy copied to clipboard

Path-style deep links render a white screen (relative Vite base loads index.html as JS)

Open michiosw opened this issue 5 months ago • 0 comments

What happens

Opening Fredy via a path-style URL like https://<host>/listings/listing/<id> shows a plain white screen — no login, no error page. These URLs are in the wild: every email sent by current releases links exactly like this (see the related email-adapter issue), and users bookmark/share them.

Why

vite.config.js has base: '', so the built index.html references assets relatively:

<script type="module" src="./assets/index-*.js">

On a nested path the browser resolves that to /listings/listing/assets/index-*.js. The SPA fallback answers with index.html — HTTP 200, text/html — and the browser refuses to execute an HTML document as a JS module. Result: white page.

Easy to confirm with curl:

GET /assets/index-*.js                   → 200 application/javascript
GET /listings/listing/assets/index-*.js → 200 text/html   ← served to the module loader

Fix

base: '/' — assets are then loaded absolutely from any URL depth. Since the app uses a HashRouter, a path-style URL then at least loads the app normally instead of dying, which keeps all already-sent email links functional. PR incoming.

michiosw avatar Jun 10 '26 13:06 michiosw