webui: an unknown /api path returns the dashboard's index.html with 200, so the UI shows a JSON parse error #1302

Closed
opened 2026-10-27 13:39:50 +00:00 by sam · 0 comments
Owner

assets() in internal/webui/server.go falls back to index.html for any path it cannot stat, so client routes deep-link. Nothing excludes /api/, so a request for an endpoint this binary does not serve gets 200 text/html. The client then fails JSON.parse and shows "Unexpected token '<', "<!doctype "... is not valid JSON". Seen when a newer dashboard called /api/control-plane/audit on an archie-ui built before that endpoint existed; reproduce with curl on any unknown /api path.
Fix at the producer: /api/* (and /health, /webhooks) never fall back to index.html; an unmatched API path returns 404 with a JSON error body. lib/api.ts then reports 'this archied does not serve ' from the status, not from a parse failure.

Acceptance criteria

curl on an unknown /api path returns 404 application/json; a Go test covers it; the dashboard shows a plain 'not served' message for it.

Close reason

Unserved /api paths answer 404 with a plain-text reason the client already displays.


Imported from beads archie-core-eihf · GitHub #1061 · type bug · priority P2 · created 2026-09-25 · closed 2026-10-10

assets() in internal/webui/server.go falls back to index.html for any path it cannot stat, so client routes deep-link. Nothing excludes /api/, so a request for an endpoint this binary does not serve gets 200 text/html. The client then fails JSON.parse and shows "Unexpected token '<', "<!doctype "... is not valid JSON". Seen when a newer dashboard called /api/control-plane/audit on an archie-ui built before that endpoint existed; reproduce with curl on any unknown /api path. Fix at the producer: /api/* (and /health, /webhooks) never fall back to index.html; an unmatched API path returns 404 with a JSON error body. lib/api.ts then reports 'this archied does not serve <path>' from the status, not from a parse failure. ### Acceptance criteria curl on an unknown /api path returns 404 application/json; a Go test covers it; the dashboard shows a plain 'not served' message for it. ### Close reason Unserved /api paths answer 404 with a plain-text reason the client already displays. --- _Imported from beads `archie-core-eihf` · GitHub #1061 · type bug · priority P2 · created 2026-09-25 · closed 2026-10-10_
sam added the mediumbug labels 2026-10-27 13:39:50 +00:00
sam self-assigned this 2026-10-27 13:39:50 +00:00
sam closed this issue 2026-10-27 13:39:50 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1302