Repository navigation
fix(vhost): isolate connections across HTTP route registrations - #5613
Draft
shizukunacho wants to merge 1 commit into
Draft
shizukunacho wants to merge 1 commit into
shizukunacho wants to merge 1 commit into
Conversation
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.
WHY
After an HTTP route is unregistered and registered again with a new backend,
HTTPReverseProxycan send new requests through the old backend's idle connection. The transport reuse key contains the domain, location, HTTP user and endpoint, which remain identical across registrations. A real HTTP regression reproduces this even when every frontend request uses a fresh TCP connection: replacing backend A with B still returns A.Give each successful route registration a unique ID and include it in the transport reuse key. Match the route once per request and use that same configuration for authentication, rewriting and dialing, including CONNECT. This also prevents a route replacement between authentication and dialing from selecting the new backend under the old request policy. Connections remain reusable within an unchanged registration.
Two regression tests fail before the change and pass afterward. They cover backend replacement, continued connection reuse within a registration, and a deterministic replacement after authentication but before dialing. The latter also verifies that subsequent requests use the replacement credentials.
Validation on Windows/amd64 with Go 1.26.11:
go test ./pkg/util/vhost -count=1go test -race ./pkg/util/vhost -count=1go vet ./pkg/util/vhostgo test -tags noweb ./server/group ./server/proxy -count=1go vet -tags noweb ./server/group ./server/proxygofmtandgit diff --checkThe full end-to-end suite was not run locally. This change concerns route unregistration and re-registration.
Draft while #5612 remains open, in accordance with the repository's one non-draft PR limit.