Repository navigation
fix(studio): serve desktop SPA on loopback listener - #10847
Merged
danielhanchen merged 7 commits intoOct 1, 2026
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
Souravrajvi0
force-pushed
the
feat/loopback-studio-ui-6a2e
branch
from
September 13, 2026 15:52
553cf88 to
e0b686d
Compare
Desktop api-only mode used tunnel_only to block the web UI on the primary 127.0.0.1 listener while still serving it on the LAN socket, which broke documented http://127.0.0.1:8888 access and secure-context features such as speech dictation. Admit the SPA when the accepting socket is loopback, using scope server rather than the Host header. Fixes unslothai#10786
Apply the same peer, Host, and proxy-header checks as bootstrap injection before admitting requests on the loopback listener. Blocks cloudflared or local reverse proxies that dial 127.0.0.1 from serving the packaged UI.
…0786) Require Host to include the accepting socket port on non-default listeners so a header-stripping reverse proxy that rewrites Host to bare 127.0.0.1 cannot reach the packaged SPA on 127.0.0.1:8888. Expand proxied-client header detection, admit Starlette TestClient's synthetic peer, and add regression tests for stripped Host and CF-on-loopback cases.
Souravrajvi0
force-pushed
the
feat/loopback-studio-ui-6a2e
branch
from
September 17, 2026 04:21
e0b686d to
fac6c70
Compare
This comment has been minimized.
This comment has been minimized.
Drop the Host authority parser, the extra proxy headers and the testclient peer special case: the SPA gate now admits exactly the requests that already qualify for bootstrap injection (loopback peer, loopback Host, no forwarding headers) when the accepting socket is loopback. Bootstrap injection itself is unchanged, so SSH or IDE port forwards to a different local port keep their autofill.
Member
|
Review record for #10847, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#290. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
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.
Summary
--api-onlyon127.0.0.1, and the packaged web UI was only served to the Cloudflare edge or the LAN listener, sohttp://127.0.0.1:8888andhttp://localhost:8888returned 404 while the LAN IP worked.getUserMedia) in the browser.Host, and noForwarded/X-Forwarded-*/X-Real-IP/CF-Connecting-IPheader. Bootstrap injection itself is unchanged.Fixes #10786
Test plan
tunnel_onlymount, base vs head:GET /via 127.0.0.1GET /withHost: localhostGET /assets/app.jsGET /chat(deep link)GET /withX-Forwarded-ForGET /withCF-Connecting-IPGET /withHost: evil.example(rebinding)pytest tests/test_lan_access_settings.py tests/test_middleware.py tests/test_account_desktop_network.py: 246 passed; the three updated tests fail on main.