Skip to content

feat(web): support serving under a sub-path via Vite base - #110

Open
voidzero wants to merge 1 commit into
offendingcommit:mainfrom
voidzero:feat/web-base-path
Open

voidzero wants to merge 1 commit into
offendingcommit:mainfrom
voidzero:feat/web-base-path

Conversation

@voidzero

Copy link
Copy Markdown

Summary

Allow hosting the web UI under a sub-path (e.g. https://example.net/honcho/) behind a reverse proxy.

  • Derive the TanStack Router basepath, the same-origin /api prefix, config.js and favicon URLs from import.meta.env.BASE_URL.
  • Build with 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 /).
  • Default base stays /, so existing web, Docker, Helm and Tauri builds are unchanged.
  • Docs: new "Serving under a sub-path" section in docs/docker.md.

Testing

  • pnpm check (Biome, tsc, Vitest) passes; a new test asserts API_PREFIX becomes /honcho/api for a /honcho/ base.
  • Image built with BASE_PATH=/honcho/: index.html references /honcho/assets/… and /honcho/config.js; /healthz, /config.js and SPA deep links return 200.
  • Running behind host nginx at /honcho/ (static dist via alias, /honcho/api/ proxied to Honcho).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant