Skip to content

Make embedded WebUI work behind a path-prefix reverse proxy - #297

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
SelfRef:fix/webui-path-prefix
Aug 22, 2026
Merged

Make embedded WebUI work behind a path-prefix reverse proxy#297
0xShug0 merged 1 commit into
0xShug0:mainfrom
SelfRef:fix/webui-path-prefix

Conversation

@SelfRef

@SelfRef SelfRef commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #294

The embedded WebUI was unusable when audiocpp_server runs behind a path-prefix
reverse proxy (e.g. llama-swap serving an instance at /upstream/<model>/):
the SvelteKit router resolved location.pathname, found no matching route, and
rendered the app's own 404 page - and the root-absolute API calls in
src/lib/api.ts escaped the prefix to the proxy root.

Changes

  • svelte.config.js - switch the client router to hash mode
    (router: { type: 'hash' }), so routing no longer depends on the pathname
    the page is served under. Together with the existing paths.relative: true
    this makes the document itself fully location-independent.
  • src/routes/+page.ts - removed; the hash router rejects the
    prerender/ssr page options at build time, and the static adapter's
    index.html fallback already produces the same single-file SPA output.
  • src/lib/api.ts - add a small apiUrl() helper that resolves the
    endpoint paths against document.baseURI, applied at the two fetch call
    sites, so all API traffic stays inside the prefix. Serving at the domain
    root is unaffected (the resolved URL is identical).
  • dist/index.html - rebuilt, since CMake embeds this artifact into
    audiocpp_server.

Testing

  • npm run build and npm run check pass (0 errors, 0 warnings).
  • Headless-browser smoke test with the built page served at
    /upstream/testmodel/ behind a stub proxy: the app renders normally (no
    404 page) and the request log shows health and v1/models fetched as
    /upstream/testmodel/health and /upstream/testmodel/v1/models - nothing
    escapes to the proxy root.
  • Full workflow (model load, TTS, cloning) previously verified manually behind
    llama-swap's /upstream/<model>/ prefix, per the issue.

Switch the SvelteKit router to hash mode so client-side routing no
longer depends on the pathname the page is served under, and resolve
API endpoint paths against the page directory so requests stay inside
the proxy prefix (e.g. llama-swap's /upstream/<model>/). Serving at
the domain root is unaffected.

Fixes 0xShug0#294
@0xShug0
0xShug0 merged commit 67d7f1a into 0xShug0:main Aug 22, 2026
6 checks passed
@0xShug0

0xShug0 commented Aug 22, 2026

Copy link
Copy Markdown
Owner

@SelfRef Merged. Thank you for the PR!

@SelfRef
SelfRef deleted the fix/webui-path-prefix branch August 22, 2026 18:34
NairoDorian added a commit to NairoDorian/speech.cpp that referenced this pull request Aug 22, 2026
Brings speech.cpp up to date with latest audio.cpp upstream main (4d383be):
- Community models: MOSS-VoiceGenerator (PR 0xShug0#278), MMS-300M-1130 forced aligner (PR 0xShug0#279), F5-TTS (PR 0xShug0#275).
- SenseASR encoder refactored to framework SAN-M modules (PR 0xShug0#285).
- Server: max_loaded_models limit with LRU eviction (PR 0xShug0#298) and opt-in session options listing.
- WebUI: reverse proxy hash routing (PR 0xShug0#297), Music3 precision packages, HeartMuLa options.
- CUDA & Memory: CUDA graph-cache eviction and idle pool trimming (PR 0xShug0#293), Supertonic vector arena reduction.
- GGML: tracked CUDA clear_graph and trim_pools as patch 0007.
- Build & CI: native model manager build flags, C++17 cleanups, CMake model-link guards preserved.
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.

WebUI unusable behind a path-prefix reverse proxy (renders its own 404; API calls escape the prefix)

2 participants