Skip to content

feat: serve UI under a URL path prefix - #754

Merged
undera merged 1 commit into
mainfrom
feat/base-path
Sep 27, 2026
Merged

undera merged 1 commit into
mainfrom
feat/base-path

Conversation

@undera

@undera undera commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Fixes #529. Supersedes #606 with a single-image approach.

Changes

  • Frontend uses relative URLs only. Vite base: "./", fetchWithDefaults resolves API paths against the page, plus the few hard-coded absolute URLs (index.html, analytics.js, post-uninstall redirect). With HashRouter, the page always sits at <prefix>/, so one build works under any prefix; the frontend never needs to know it.
  • Trailing-slash guard in index.html: /helm-dashboard → /helm-dashboard/, otherwise relative URLs would resolve to /.
  • --base-path flag / HD_BASE_PATH env: mounts all routes under the prefix. Only needed for proxies that forward the full path; prefix-stripping proxies (ingress-nginx rewrite-target, as in Can't serve from a subpath #529) need no configuration.
  • Chart: dashboard.basePath sets the env var and prefixes the liveness/readiness probe paths.
  • Swagger "Try it out" targets the page-relative API location.
  • Fix: logo.svg and analytics.js, which index.html references from the dist root, were never served (404 since v2.0), so the favicon and browser analytics did not load. They are served now.
  • Lint-staged ran eslint on public/, which the lint script never covers; excluded it. Prettier reformatted analytics.js as a side effect.

Testing

Local binary against kind with a sample release, rendered in headless Chrome:

  • plain /
  • --base-path /helm-dashboard, accessed with and without the trailing slash
  • behind a prefix-stripping reverse proxy at /helm-dashboard

All app/API requests return 200 in each setup; the Swagger server resolves to the prefixed URL. New Go test covers prefixed routing. Not tested: real ingress-nginx with the chart deployed in-cluster.

🤖 Generated with Claude Code

Frontend now uses relative URLs only (Vite base "./", API paths resolved
against the page), so one build works under any prefix. For proxies that
strip the prefix nothing needs configuring; for those forwarding the full
path, the new --base-path flag / HD_BASE_PATH mounts routes under it.
Chart gets dashboard.basePath.

Also serve logo.svg and analytics.js that index.html references from the
dist root (were 404 since v2.0), and point Swagger "Try it out" at the
page-relative API location. Exclude public/ from eslint, matching the
`lint` script scope that lint-staged bypassed.

Fixes #529

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 47.61905% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.96%. Comparing base (4432071) to head (55a796b).
⚠️ Report is 67 commits behind head on main.

Files with missing lines Patch % Lines
main.go 0.00% 7 Missing ⚠️
pkg/dashboard/api.go 83.33% 2 Missing ⚠️
pkg/dashboard/server.go 0.00% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #754      +/-   ##
==========================================
+ Coverage   21.92%   29.96%   +8.03%     
==========================================
  Files          14       15       +1     
  Lines        2239     2593     +354     
==========================================
+ Hits          491      777     +286     
- Misses       1701     1742      +41     
- Partials       47       74      +27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@undera
undera marked this pull request as ready for review September 27, 2026 13:18
@undera
undera merged commit 05846f2 into main Sep 27, 2026
4 checks passed
@undera
undera deleted the feat/base-path branch September 27, 2026 13:19
@undera undera mentioned this pull request Sep 27, 2026
3 of 4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't serve from a subpath

2 participants