From 0389495388dd73cd5b3292860fd6d3254dfbb37b Mon Sep 17 00:00:00 2001 From: localai-org-maint-bot Date: Sat, 18 Jul 2026 08:38:26 +0200 Subject: [PATCH] fix(webui): use relative asset base so fonts and lazy chunks honor X-Forwarded-Prefix (#10889) (#10904) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 `` 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 `` 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 Co-authored-by: Ettore Di Giacinto --- core/http/react-ui/vite.config.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/http/react-ui/vite.config.js b/core/http/react-ui/vite.config.js index 401aaf9d9..0e1296f74 100644 --- a/core/http/react-ui/vite.config.js +++ b/core/http/react-ui/vite.config.js @@ -32,7 +32,15 @@ export default defineConfig({ ] : []), ], - base: '/', + // Relative base so every generated URL (entry scripts in index.html, CSS + // `url()` font references, and lazily-imported route chunks) resolves against + // the file that references it rather than the origin root. When LocalAI is + // served under a reverse-proxy subpath (X-Forwarded-Prefix, e.g. `/llm/`), + // an absolute `/assets/...` bypasses the prefix and 404s — breaking fonts + // ("tofu" glyphs) and lazy-loaded chunks. index.html's now-relative refs + // resolve via the `` that serveIndex always injects (see + // core/http/app.go), so both proxied and root deployments load correctly. + base: './', server: { port: 3000, proxy: {