Skip to content

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

Closed

Description

@SelfRef

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:

  1. 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.
  2. 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.

Activity

  1. 0xShug0 commented on Aug 22, 2026

    @0xShug0
    Owner

    @SelfRef Thanks for reporting this issue and PRs are very weclome!

  2. added a commit that references this issue on Aug 22, 2026
    9760864
  3. added a commit that references this issue on Aug 22, 2026
    67d7f1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions