Skip to content

feat(base-path): subpath mounting via BASE_PATH env - #19

Merged
paultranvan merged 1 commit into
mainfrom
feat/base-path-support
Apr 17, 2026
Merged

feat(base-path): subpath mounting via BASE_PATH env#19
paultranvan merged 1 commit into
mainfrom
feat/base-path-support

Conversation

@guimard

@guimard guimard commented Apr 17, 2026

Copy link
Copy Markdown
Member

Summary

Enables deploying the indexer-ui under a subpath (e.g. /indexerui/) on the same vhost as the OpenRag backend. This removes the need for separate hostnames and eliminates the cross-origin cookie problem when the browser hits both front and back under different origins.

Changes

  • svelte.config.js: kit.paths.base = process.env.BASE_PATH ?? ''
  • Dockerfile: ARG BASE_PATH forwarded to the build stage.
  • Every internal fetch / navigation now prefixed with base from $app/paths:
    • src/lib/api/index.tsloadConfig()
    • src/lib/components/indexer/Header.svelte
    • src/lib/components/layout/NavBar.svelte
    • src/lib/components/dashboard/Header.svelte
    • src/routes/(home)/+page.svelte
    • src/routes/+layout.svelte
    • src/routes/indexer/{+layout,+page}.svelte
    • src/routes/indexer/partition/[partition]/+page.svelte

Backward compatibility

BASE_PATH unset → empty base → root-level deployment exactly as today.

Deploying under a subpath

docker build --build-arg BASE_PATH=/indexerui -t indexer-ui:subpath .

Then the reverse proxy must forward /indexerui/* to the container without stripping the prefix (SvelteKit with paths.base expects to see the prefix). Example nginx:

location /indexerui/ {
    proxy_pass http://indexer-ui:3000;   # NO trailing slash = path kept intact
}

Test plan

  • npm run check — no new errors (8 pre-existing)
  • npm run build — succeeds
  • Root deployment (no BASE_PATH) — full flow still works
  • Subpath deployment (BASE_PATH=/indexerui) — logo, nav, partition links, loadConfig, goto("/") all resolve under the prefix

Enables deploying indexer-ui under a subpath (e.g. /indexerui/) on the
same vhost as the OpenRag backend, removing the need for separate
hostnames and eliminating the cross-origin cookie problem.

Changes:
- svelte.config.js: kit.paths.base = process.env.BASE_PATH ?? ''
- Dockerfile: ARG BASE_PATH forwarded to the build stage
- Prefix every internal fetch/navigation with `base` from $app/paths:
  - src/lib/api/index.ts — loadConfig()
  - src/lib/components/indexer/Header.svelte — partition links
  - src/lib/components/layout/NavBar.svelte — home/indexer/dashboard
  - src/lib/components/dashboard/Header.svelte — dashboard link
  - src/routes/(home)/+page.svelte — CTA links
  - src/routes/+layout.svelte — goto fallback
  - src/routes/indexer/+layout.svelte + indexer/+page.svelte +
    indexer/partition/[partition]/+page.svelte — goto() and partition
    file links

Leave BASE_PATH unset for root-level deployment (existing behaviour).
guimard added a commit to linagora/openrag that referenced this pull request Apr 17, 2026
Lets operators mount indexer-ui under a subpath (e.g. `/indexerui/`)
on the same vhost as the OpenRag backend, eliminating the cross-origin
cookie problem when front and back were on different hosts.

Changes:
- docker-compose.yaml: forward INDEXERUI_BASE_PATH env as BASE_PATH
  build-arg to the indexer-ui Dockerfile.
- .env.example: document INDEXERUI_BASE_PATH (commented, empty = root,
  rebuild required after change).
- extern/indexer-ui: bump pointer to the merged main of openrag-admin-ui
  (c967017 — OIDC support).

Pairs with linagora/openrag-admin-ui#19 (base-path support in the
SvelteKit app). Merging that PR + a subsequent submodule pointer bump
are required to actually deploy under a subpath. Without the PR merged,
setting INDEXERUI_BASE_PATH has no effect (the build-arg is passed but
the Dockerfile it reaches doesn't honor it yet).
@paultranvan
paultranvan merged commit 5055db3 into main Apr 17, 2026
EnjoyBacon7 pushed a commit to linagora/openrag that referenced this pull request Apr 20, 2026
Lets operators mount indexer-ui under a subpath (e.g. `/indexerui/`)
on the same vhost as the OpenRag backend, eliminating the cross-origin
cookie problem when front and back were on different hosts.

Changes:
- docker-compose.yaml: forward INDEXERUI_BASE_PATH env as BASE_PATH
  build-arg to the indexer-ui Dockerfile.
- .env.example: document INDEXERUI_BASE_PATH (commented, empty = root,
  rebuild required after change).
- extern/indexer-ui: bump pointer to the merged main of openrag-admin-ui
  (c967017 — OIDC support).

Pairs with linagora/openrag-admin-ui#19 (base-path support in the
SvelteKit app). Merging that PR + a subsequent submodule pointer bump
are required to actually deploy under a subpath. Without the PR merged,
setting INDEXERUI_BASE_PATH has no effect (the build-arg is passed but
the Dockerfile it reaches doesn't honor it yet).
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.

2 participants