reverseproxy: Add regression test for DialInfo network override - #7758
Merged
francislavoie merged 1 commit intoMay 20, 2026
Conversation
Covers caddyserver#6447, the tcp4/tcp6 upstream fallback fixed by caddyserver#7300. dialContext honors the resolved DialInfo network when no upstream proxy is in use, and skips it for non-unix networks when a proxy is active. The test pins both halves against a real tcp4 listener.
francislavoie
approved these changes
May 20, 2026
This was referenced Jun 2, 2026
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.
Adds regression coverage for #6447, the tcp4/tcp6 upstream bug fixed by #7300.
A
tcp4-prefixed upstream silently fell back to plaintcp, becausedialContextonly honored the resolvedDialInfonetwork for unix sockets. #7300 widened that condition so DialInfo is honored whenever no upstream HTTP proxy is in use, and skipped for non-unix networks when a proxy is active. No test pinned either half.What this tests
The test sets a
DialInfowith networktcp4in the request context, then checks whereDialContextconnects against a realtcp4listener.DialInfoaddressReverting the #7300 condition makes both cases fail, so the test catches the original regression.
Assistance Disclosure
Claude wrote the test. I reviewed it, ran the reverseproxy suite, and verified it fails against the pre-#7300 behavior.