frontend: subpath-safe fetch() in /model command#4448
Conversation
cmdModel() had the only two root-absolute fetch('/api/...') calls left in the
frontend. Under a reverse proxy that mounts the app at a subpath (e.g.
jupyter-server-proxy at /proxy/<port>/), a root-absolute path escapes the mount
and 404s, so /model can't load the catalog or update the session. Resolve both
against document.baseURI (falling back to location.href) like every other fetch
in the frontend already does.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| static/commands.js | Replaces the last two root-absolute fetch('/api/...') calls in cmdModel() with subpath-safe new URL('api/...', document.baseURI |
Reviews (1): Last reviewed commit: "frontend: subpath-safe fetch() in /model..." | Re-trigger Greptile
|
Thanks for this — it's a clean, well-scoped fix. SummaryReading Code referenceThe two changed lines now match the convention every other fetch already uses: const resp=await fetch(new URL('api/models',document.baseURI||location.href).href);
...
const resp=await fetch(new URL('api/session/update',document.baseURI||location.href).href,{This is byte-for-byte the same shape as VerificationI confirmed against
RecommendationLooks good to merge. Two optional follow-ups, neither blocking:
|
Release v0.51.508 — RS (/model command works under reverse-proxy subpath, #4448)
…nesquena#4448) Co-authored-by: tomtong2015 <tomtong2015@users.noreply.github.com> Closes nesquena#4448
cmdModel() had the only two root-absolute fetch('/api/...') calls left in the frontend. Under a reverse proxy that mounts the app at a subpath (e.g. jupyter-server-proxy at /proxy//), a root-absolute path escapes the mount and 404s, so /model can't load the catalog or update the session. Resolve both against document.baseURI (falling back to location.href) like every other fetch in the frontend already does.