Make embedded WebUI work behind a path-prefix reverse proxy - #297
Merged
Conversation
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
Owner
|
@SelfRef Merged. Thank you for the PR! |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #294
The embedded WebUI was unusable when
audiocpp_serverruns behind a path-prefixreverse proxy (e.g. llama-swap serving an instance at
/upstream/<model>/):the SvelteKit router resolved
location.pathname, found no matching route, andrendered the app's own 404 page - and the root-absolute API calls in
src/lib/api.tsescaped 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 pathnamethe page is served under. Together with the existing
paths.relative: truethis makes the document itself fully location-independent.
src/routes/+page.ts- removed; the hash router rejects theprerender/ssrpage options at build time, and the static adapter'sindex.htmlfallback already produces the same single-file SPA output.src/lib/api.ts- add a smallapiUrl()helper that resolves theendpoint paths against
document.baseURI, applied at the twofetchcallsites, 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 intoaudiocpp_server.Testing
npm run buildandnpm run checkpass (0 errors, 0 warnings)./upstream/testmodel/behind a stub proxy: the app renders normally (no404 page) and the request log shows
healthandv1/modelsfetched as/upstream/testmodel/healthand/upstream/testmodel/v1/models- nothingescapes to the proxy root.
llama-swap's
/upstream/<model>/prefix, per the issue.