You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug?]: API routes not matched when server.baseURL is set #2106
When server.baseURL is configured in the Vinxi/SolidStart config (e.g. server: { baseURL: '/admin' }), API routes defined in src/routes/ are never matched. Requests to /admin/api/my-route fall through to the page renderer and return a 404 HTML response instead of executing the API handler.
The root cause is in @solidjs/start/dist/server/handler.js:
// line 29constmatch=matchAPIRoute(newURL(event.request.url).pathname,event.request.method)
event.request.url contains the full pathname including the baseURL prefix — e.g. /admin/api/my-route. However, matchAPIRoute looks up routes registered from the file system, which are stored without the prefix (e.g. /api/my-route). The lookup always fails, so all API routes become unreachable.
Expected behavior 🤔
API routes defined in src/routes/api/ should be matched and executed correctly regardless of the server.baseURL setting. matchAPIRoute should strip the server.baseURL prefix from the pathname before performing the route lookup — the same way @solidjs/router's base prop strips it for page route matching on the client.
Start the dev server and request GET /app/api/hello
Result:404 — the SPA catch-all ([...404]) renders instead of the API handler. Expected:200 { "ok": true }
Context 🔦
Workaround: Move the route file to mirror the full path including the base — src/routes/app/api/hello.ts — so the registered route path /app/api/hello matches what matchAPIRoute receives. This is unergonomic and forces duplication of the base prefix in the file structure.
Activity
[-][Bug?]:[/-][+][Bug?]: API routes not matched when server.baseURL is set[/+]themavik commentedon Mar 19, 2026
Fix submitted in #2117.