Skip to content

fix(dashboard): include OMNIROUTE_BASE_PATH in displayed API base URL - #8514

Merged
diegosouzapw merged 3 commits into
cheaper-inference:release/v3.8.49from
rqzbeh:fix/display-base-url-basepath
Jul 26, 2026
Merged

diegosouzapw merged 3 commits into
cheaper-inference:release/v3.8.49from
rqzbeh:fix/display-base-url-basepath

Conversation

@rqzbeh

@rqzbeh rqzbeh commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

When OmniRoute is deployed behind a reverse proxy under a subpath (OMNIROUTE_BASE_PATH=/omniroute), the dashboard Endpoints page builds curl/API examples as:

https://host/v1

instead of:

https://host/omniroute/v1

Root cause: useDisplayBaseUrl preferred window.location.origin (no path) and appended /v1, ignoring Next.js basePath / OMNIROUTE_BASE_PATH.

Changes

  • resolveDisplayBaseUrl: keep a configured public URL that already includes a path; otherwise append the deploy basePath when resolving a public browser origin.
  • next.config.mjs: mirror OMNIROUTE_BASE_PATH → NEXT_PUBLIC_OMNIROUTE_BASE_PATH so the client bundle can read it after build.
  • .env.example: document subpath display + rebuild requirement.
  • Tests: coverage for basePath-aware resolution and normalizeBasePath.

Test plan

  • Root deploy (no OMNIROUTE_BASE_PATH): Endpoints still show https://host/v1
  • Subpath deploy (OMNIROUTE_BASE_PATH=/omniroute, rebuild): Endpoints show https://host/omniroute/v1
  • NEXT_PUBLIC_BASE_URL=https://host/omniroute: display keeps the path even when window.location.origin is bare https://host
  • Tunnel/alternate public origin still preferred over a different configured host (existing behavior)
  • vitest run src/shared/hooks/__tests__/useDisplayBaseUrl.test.tsx

Notes

This is display-only (curl snippets / endpoint cards). Absolute client fetch("/api/...") under basePath remains a separate concern often handled at the reverse proxy; this PR does not change authz or routing.

When OmniRoute is served under a reverse-proxy subpath (OMNIROUTE_BASE_PATH),
the Endpoints UI built display URLs from window.location.origin alone and
appended /v1, producing https://host/v1 instead of https://host/omniroute/v1.

- Prefer NEXT_PUBLIC_BASE_URL when it already includes a non-root path
- Append NEXT_PUBLIC_OMNIROUTE_BASE_PATH (mirrored from OMNIROUTE_BASE_PATH
  at build time) when resolving a bare public origin
- Document subpath display behavior in .env.example
- Add unit coverage for basePath-aware resolution
@diegosouzapw
diegosouzapw merged commit 8115867 into cheaper-inference:release/v3.8.49 Jul 26, 2026
5 checks passed
diegosouzapw pushed a commit that referenced this pull request Jul 26, 2026
…KUP_SCHEDULE_JOB_INTERVAL_MS (#8690)

Both vars were introduced in code without a .env.example / ENVIRONMENT.md
entry, so `check:env-doc-sync` (docs-sync-strict / docs-gates) went red on
release/v3.8.49 with "In code but missing from .env.example: 2":

- NEXT_PUBLIC_OMNIROUTE_BASE_PATH — src/shared/hooks/useDisplayBaseUrl.ts (#8514)
- OMNIROUTE_BACKUP_SCHEDULE_JOB_INTERVAL_MS — src/lib/jobs/backupScheduleJob.ts (#8517)

Documents both in .env.example and docs/reference/ENVIRONMENT.md rather than
adding allowlist entries: both are real operator-tunable knobs, so the
allowlist would hide a genuine gap.

Refs #8540

Co-authored-by: rqzbeh <rqzbeh@users.noreply.github.com>
Co-authored-by: maxmad64bis <maxmad64bis@users.noreply.github.com>
@diegosouzapw diegosouzapw mentioned this pull request Jul 28, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…cheaper-inference#8514)

* fix(dashboard): include OMNIROUTE_BASE_PATH in displayed API base URL

When OmniRoute is served under a reverse-proxy subpath (OMNIROUTE_BASE_PATH),
the Endpoints UI built display URLs from window.location.origin alone and
appended /v1, producing https://host/v1 instead of https://host/omniroute/v1.

- Prefer NEXT_PUBLIC_BASE_URL when it already includes a non-root path
- Append NEXT_PUBLIC_OMNIROUTE_BASE_PATH (mirrored from OMNIROUTE_BASE_PATH
  at build time) when resolving a bare public origin
- Document subpath display behavior in .env.example
- Add unit coverage for basePath-aware resolution

* docs(changelog): add fragment for cheaper-inference#8514 display basePath fix

---------

Co-authored-by: rqzbeh <rqzbeh@users.noreply.github.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…KUP_SCHEDULE_JOB_INTERVAL_MS (cheaper-inference#8690)

Both vars were introduced in code without a .env.example / ENVIRONMENT.md
entry, so `check:env-doc-sync` (docs-sync-strict / docs-gates) went red on
release/v3.8.49 with "In code but missing from .env.example: 2":

- NEXT_PUBLIC_OMNIROUTE_BASE_PATH — src/shared/hooks/useDisplayBaseUrl.ts (cheaper-inference#8514)
- OMNIROUTE_BACKUP_SCHEDULE_JOB_INTERVAL_MS — src/lib/jobs/backupScheduleJob.ts (cheaper-inference#8517)

Documents both in .env.example and docs/reference/ENVIRONMENT.md rather than
adding allowlist entries: both are real operator-tunable knobs, so the
allowlist would hide a genuine gap.

Refs cheaper-inference#8540

Co-authored-by: rqzbeh <rqzbeh@users.noreply.github.com>
Co-authored-by: maxmad64bis <maxmad64bis@users.noreply.github.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…cheaper-inference#8514)

* fix(dashboard): include OMNIROUTE_BASE_PATH in displayed API base URL

When OmniRoute is served under a reverse-proxy subpath (OMNIROUTE_BASE_PATH),
the Endpoints UI built display URLs from window.location.origin alone and
appended /v1, producing https://host/v1 instead of https://host/omniroute/v1.

- Prefer NEXT_PUBLIC_BASE_URL when it already includes a non-root path
- Append NEXT_PUBLIC_OMNIROUTE_BASE_PATH (mirrored from OMNIROUTE_BASE_PATH
  at build time) when resolving a bare public origin
- Document subpath display behavior in .env.example
- Add unit coverage for basePath-aware resolution

* docs(changelog): add fragment for cheaper-inference#8514 display basePath fix

---------

Co-authored-by: rqzbeh <rqzbeh@users.noreply.github.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…KUP_SCHEDULE_JOB_INTERVAL_MS (cheaper-inference#8690)

Both vars were introduced in code without a .env.example / ENVIRONMENT.md
entry, so `check:env-doc-sync` (docs-sync-strict / docs-gates) went red on
release/v3.8.49 with "In code but missing from .env.example: 2":

- NEXT_PUBLIC_OMNIROUTE_BASE_PATH — src/shared/hooks/useDisplayBaseUrl.ts (cheaper-inference#8514)
- OMNIROUTE_BACKUP_SCHEDULE_JOB_INTERVAL_MS — src/lib/jobs/backupScheduleJob.ts (cheaper-inference#8517)

Documents both in .env.example and docs/reference/ENVIRONMENT.md rather than
adding allowlist entries: both are real operator-tunable knobs, so the
allowlist would hide a genuine gap.

Refs cheaper-inference#8540

Co-authored-by: rqzbeh <rqzbeh@users.noreply.github.com>
Co-authored-by: maxmad64bis <maxmad64bis@users.noreply.github.com>
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