Pull requests / #82

#82 Web app works behind path-prefixed reverse proxies

closed · merged 2026-09-29 · @mikicvi · 0 评论 · 在 GitHub 查看

Server & API

描述

The page referenced its stylesheet, script, sprite, fonts and every API call with absolute paths (`/web/app.css`, `fetch("/health")`, `url("/fonts/...")`). Behind a reverse proxy that mounts the app under a sub-path — llama-swap's `/upstream/<model-id>/`, an nginx subpath — those resolve to the proxy root and 404, leaving an unstyled page stuck at "Connecting…".

Changes, all mechanical:

- `index.html`: `(href|src)="/web/…` → relative `web/…`
- `app.js`: `fetch("/…` → `fetch("…` (every fetch in the app targets a same-origin endpoint served next to the page)
- `tokens.css`: `url("/fonts/…` → `url("../fonts/…"` (fonts have their own top-level `/fonts/` route, one level above the CSS)

Standalone at `/` resolves identically, so nothing changes there.

Verified behind llama-swap's `/upstream/<model-id>/` prefix: page, all three stylesheets, fonts, sprite, `/health`, `/settings` and a streamed `/v1/chat/completions` POST all return 200, plus the same checks standalone at `/`.

站内延伸阅读

链到安装、模型与版本说明,便于 SEO/GEO,非官方 issue 正文。