Reloading or deep-linking any page but / returns 404: no SPA fallback #164
Labels
No labels
area/ai
area/backend
area/frontend
area/infra
area/scheduler
area/wled
good-first-issue
priority/high
priority/low
priority/medium
security
type/bug
type/chore
type/ci-cd
type/docs
type/feature
type/qa
v1.0.0
v1.1.0
v1.2.0
v2.0.0
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/Iris-WLED#164
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
The built frontend is served with
StaticFiles(html=True)(backend/app/main.py, around line 120). That servesindex.htmlfor/only. A direct load or reload of a client-side route (/settings,/remote,/audit-log) returns 404.Why it matters now:
/?filter=…&date=…to work around it./remote(#24) is meant to be bookmarked on a phone, and a bookmark that 404s is not much of a remote./remoteand to the review queue to load directly.Fix
index.htmlfor any GET that isn't an API, auth, metrics or static-asset path and doesn't match a file. Do this with a catch-all route registered after the API routers, or with aStaticFilessubclass that falls back on 404./api/*,/auth/*or/metrics. An unknown API path must stay a JSON 404, not return HTML with a 200./remoteand/settingsreturnindex.html;/api/v1/does-not-existis a JSON 404; a missing asset under/assets/is still a 404./remote.Picking this up now. It's small and separate from the rest, and #154 (the installable app) needs it.
Done in #170 (squash-merged, CI green).
backend/app/spa.py'sSPAStaticFilesfalls back toindex.html, withCache-Control: no-cache, for client-side routes. Backend paths (/api/,/auth/,/metrics,/openapi.json) and missing assets (anything with a file extension, or under/assets/) still return a real 404. Covered by 11 backend tests and an E2E that loads/settingsdirectly and then reloads it. This unblocks #154.