Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes xdebug connectivity issues on Windows with WSL2 mirrored networking mode by improving how the Windows host IP address is detected. The previous implementation would incorrectly select IP addresses from VMware or VirtualBox host-only adapters, breaking xdebug connections.
- Replaces simple "first non-link-local IPv4" selection with default-route-based detection
- Filters routes to find the primary outbound interface using Windows' best default route (0.0.0.0/0)
- Improves error handling with CombinedOutput and more descriptive error messages
|
Download the artifacts for this pull request:
See Testing a PR. |
bf59f1f to
f307fc6
Compare
0a2c4c2 to
d4d31b1
Compare
This reverts commit ece5f6d.
d4d31b1 to
fa040e0
Compare
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.
The Issue
The previous technique for finding the windows-side IP address for host.docker.internal when using mirrored networking mode could fail if there were VMWare or Virtualbox interfaces on the machine. It made my machine stop being able to do xdebug because of our experiments with VMWare.
How This PR Solves The Issue
This replaces the previous PowerShell-based host-IP detection (which simply
selected the first non–link-local IPv4 address on Windows) with a more accurate
approach. Instead of scanning all network adapters, the new implementation
selects the IPv4 address associated with the best default route
(
0.0.0.0/0) on Windows. This is the same logic Windows uses to determineits primary outbound interface.
By basing detection on the default route instead of interface ordering or
adapter names, this method:
Host-Only, and other isolated networks that cannot accept incoming
connections from WSL2 containers.
192.168.56.1, which are reachablevia ping but cannot carry TCP connections back to IDE listeners (e.g., on
port 9003).
without customization.
multiple NICs and the old heuristic frequently selected the wrong one.
As a result,
host.docker.internalnow maps to an IP that actually acceptsconnections from the DDEV web container in WSL2 mirrored mode, fixing Xdebug
connectivity failures and other host-access problems.
Manual Testing Instructions
Use Xdebug on mirrored networking mode
Automated Testing Overview
I think the existing TestDdevXdebugEnabled test should properly test this.
Release/Deployment Notes
Assisted heavily in debugging and code creation by ChatGPT