Repository navigation
rc-gateway: loopback-only second front for a same-host browser - #63
Merged
Merged
Conversation
…net address Two tailscale nodes on one physical machine have no route between them, so a gateway bound to the WSL tailnet address cannot be reached by the browser running on that same machine's Windows side. Measured: TCP to the tailnet IP fails from Windows while Windows to WSL loopback succeeds, which is why the phone works and the laptop does not on either URL form. Adds a second, loopback-only TLS front on the same port behind --loopback-bind, so the public bind stays exactly as it is. A non-loopback value is refused twice: as a BindSecurityError before any side effect, and again inside the front. Widening the single bind to 0.0.0.0 was the alternative and is deliberately not taken, since that also exposes the gateway on the LAN interface. The extra socket is bound before the public one so the listening callback reports a settled state, and a collision on it logs without taking the public bind down. It is skipped when the primary already is that address, so a loopback gateway does not print a false failure every boot. Closes InfiniteInsight/Qwen-Code-Remote#88
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.
Closes InfiniteInsight/Qwen-Code-Remote#88
What
A second, loopback-only TLS front on the same port, behind
--loopback-bind <host>/
QWEN_RC_LOOPBACK_BIND. The public bind is untouched.Why
Two tailscale nodes on one physical machine have no route between them. The
gateway binds the WSL tailnet address, so the browser on that same machine's
Windows side cannot reach it on either URL form, while the phone (a real third
peer) reaches both. Measured: TCP to the tailnet IP from Windows is
TcpTestSucceeded Falsewith pingTimedOut, while Windows to WSL loopback isTcpTestSucceeded Trueand a WSL listener printedGOT CONNECTION.Why not
--host 0.0.0.0That also exposes the gateway on the LAN interface (192.168.0.158 here). Declined
by the operator. This change adds no network-reachable surface: a non-loopback
value is refused as a
BindSecurityErrorbefore any side effect, and again insidecreateHttp2Front.Behaviour details
gateway down.
print a false failure every boot.
Security note, in the code and in a test
Reaching a front is what earns the peer attestation, so a local process gains the
ability to carry a peer address. It already had that: connecting to the gateway's
own bind address from this host is an ordinary local connect.
forwardableHeadersrewrites rather than copies the peer fields, so the address a client is given is
the one its own socket has. A case pre-seeds the peer header over the loopback path
to pin it.
Verification
src/tls/http2Front.loopback.test.ts, 4 cases, all pass.isLoopbackHostcheck fails exactlyrefuses a second bind that is not loopback(1 failed | 3 passed), then restored.tsc --noEmitclean.