Skip to content

Commit 0389495

Browse files
fix(webui): use relative asset base so fonts and lazy chunks honor X-Forwarded-Prefix (#10889) (#10904)
The Vite build emitted path-absolute asset URLs (base: '/'). index.html entry scripts and the favicon were rewritten to include the reverse-proxy prefix in serveIndex, but two reference kinds are not in index.html and so bypassed that rewrite: - CSS `url()` font references (e.g. Font Awesome .woff2), which the browser resolves relative to the stylesheet and which `<base href>` never affects - lazily-imported route chunks, whose preload base came from the absolute Vite base Under a subpath mount (X-Forwarded-Prefix: /llm/) both were fetched from the origin root, 404ing — missing-glyph "tofu" icons and broken lazy-loaded pages. Switch Vite to a relative base ('./') so every generated URL resolves against the file that references it: CSS fonts and route chunks now load from `/llm/assets/...`, and index.html's now-relative entry refs resolve via the `<base href>` serveIndex already injects on every response. Root deployments are unaffected. The existing path-absolute rewrite in app.go still covers the public `/favicon.svg`. Assisted-by: Claude:opus-4.8 [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 2f01109 commit 0389495

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

core/http/react-ui/vite.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ export default defineConfig({
3232
]
3333
: []),
3434
],
35-
base: '/',
35+
// Relative base so every generated URL (entry scripts in index.html, CSS
36+
// `url()` font references, and lazily-imported route chunks) resolves against
37+
// the file that references it rather than the origin root. When LocalAI is
38+
// served under a reverse-proxy subpath (X-Forwarded-Prefix, e.g. `/llm/`),
39+
// an absolute `/assets/...` bypasses the prefix and 404s — breaking fonts
40+
// ("tofu" glyphs) and lazy-loaded chunks. index.html's now-relative refs
41+
// resolve via the `<base href>` that serveIndex always injects (see
42+
// core/http/app.go), so both proxied and root deployments load correctly.
43+
base: './',
3644
server: {
3745
port: 3000,
3846
proxy: {

0 commit comments

Comments
 (0)