Use case
llama-swap (https://github.com/mostlygeek/llama-swap) can manage audiocpp_server
as an on-demand TTS backend: it starts/stops one instance per configured model and
proxies it under a path prefix, e.g. https://host/upstream/<model>/. The OpenAI
endpoints work great this way - but the embedded WebUI does not.
Problem
The WebUI is a SvelteKit app built for the domain root:
- Pathname routing - the document is served fine at
/upstream/<model>/ (HTTP 200), but the client-side router resolves the
current location.pathname, finds no matching route, and renders the
app's own 404 page. So any path-prefix deployment shows "404" even though
the server is healthy.
- Root-absolute API calls -
src/lib/api.ts fetches /health,
/v1/models, /v1/audio/speech, … with absolute paths, so behind a prefix
they escape to the proxy root instead of reaching the instance.
What fixed it for me (tested)
svelte.config.js: kit.router = { type: 'hash' } - the pathname stops
mattering, and paths.relative: true (already set) keeps assets working.
Requires dropping the prerender/ssr page options from
src/routes/+page.ts (hash router rejects them at build time).
- Rebasing the root-absolute fetches onto the page's directory. I used a
small window.fetch wrapper in app.html (no-op when served at a real
root); making the api.ts paths relative would be the cleaner in-tree fix.
With those two changes the full UI (model load, TTS, cloning) works behind
/upstream/<model>/ with zero proxy configuration. Happy to send a PR if
you're open to either approach.
Use case
llama-swap (https://github.com/mostlygeek/llama-swap) can manage
audiocpp_serveras an on-demand TTS backend: it starts/stops one instance per configured model and
proxies it under a path prefix, e.g.
https://host/upstream/<model>/. The OpenAIendpoints work great this way - but the embedded WebUI does not.
Problem
The WebUI is a SvelteKit app built for the domain root:
/upstream/<model>/(HTTP 200), but the client-side router resolves thecurrent
location.pathname, finds no matching route, and renders theapp's own 404 page. So any path-prefix deployment shows "404" even though
the server is healthy.
src/lib/api.tsfetches/health,/v1/models,/v1/audio/speech, … with absolute paths, so behind a prefixthey escape to the proxy root instead of reaching the instance.
What fixed it for me (tested)
svelte.config.js:kit.router = { type: 'hash' }- the pathname stopsmattering, and
paths.relative: true(already set) keeps assets working.Requires dropping the
prerender/ssrpage options fromsrc/routes/+page.ts(hash router rejects them at build time).small
window.fetchwrapper inapp.html(no-op when served at a realroot); making the
api.tspaths relative would be the cleaner in-tree fix.With those two changes the full UI (model load, TTS, cloning) works behind
/upstream/<model>/with zero proxy configuration. Happy to send a PR ifyou're open to either approach.