Repository navigation
feat(web): support serving under a sub-path via Vite base - #110
Conversation
Derive the router basepath, the same-origin /api prefix, config.js and favicon URLs from import.meta.env.BASE_URL, so a build with --base /honcho/ works behind a reverse proxy. Default base stays /, so nothing changes for existing deployments. The Docker image takes a BASE_PATH build arg.
offendingcommit
left a comment
There was a problem hiding this comment.
Thanks, this is clean. BASE_URL is used consistently for the router basepath, the /api prefix, config.js and the favicons, and the default / leaves the web, Docker, Helm and Tauri builds as they were. The package build script is tsc -b && vite build, so --base reaches Vite as intended. CI is green.
Optional follow-up: the Vite dev middleware in vite.config.ts still mounts at the literal /api. A dev server started with a non-root --base would therefore miss the proxy. That's a dev-only edge case and doesn't block this PR.
|
@offendingcommit Thanks for reviewing and merging this PR! I've addressed your optional follow-up about the Vite dev middleware in #112. The proxy now respects the configured base path, with HTTP regression checks for both |
Summary
Allow hosting the web UI under a sub-path (e.g.
https://example.net/honcho/) behind a reverse proxy.basepath, the same-origin/apiprefix,config.jsand favicon URLs fromimport.meta.env.BASE_URL.pnpm --filter @openconcho/web build --base /honcho/; the Docker image accepts--build-arg BASE_PATH=/honcho/(the outer proxy strips the prefix, the image's nginx keeps serving at/)./, so existing web, Docker, Helm and Tauri builds are unchanged.docs/docker.md.Testing
pnpm check(Biome, tsc, Vitest) passes; a new test assertsAPI_PREFIXbecomes/honcho/apifor a/honcho/base.BASE_PATH=/honcho/:index.htmlreferences/honcho/assets/…and/honcho/config.js;/healthz,/config.jsand SPA deep links return 200./honcho/(staticdistviaalias,/honcho/api/proxied to Honcho).