fix: allow binding when strictPort is set but wildcard port is in use#22150
Merged
sapphi-red merged 10 commits intomainfrom Apr 13, 2026
Merged
fix: allow binding when strictPort is set but wildcard port is in use#22150sapphi-red merged 10 commits intomainfrom
sapphi-red merged 10 commits intomainfrom
Conversation
7 tasks
Agent-Logs-Url: https://github.com/vitejs/vite/sessions/9201cbf8-eb3b-4af9-965b-ca88e42eda6a Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
… variable names in tests Agent-Logs-Url: https://github.com/vitejs/vite/sessions/9201cbf8-eb3b-4af9-965b-ca88e42eda6a Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Vite server rejection of specific IP binding
fix: allow specific IP host binding when wildcard port is in use
Apr 6, 2026
sapphi-red
reviewed
Apr 6, 2026
…ondition Agent-Logs-Url: https://github.com/vitejs/vite/sessions/1310d5a7-55fd-498d-9b49-e3224f8aa89a Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot
AI
changed the title
fix: allow specific IP host binding when wildcard port is in use
fix: allow binding when strictPort is set but wildcard port is in use
Apr 6, 2026
sapphi-red
approved these changes
Apr 7, 2026
bluwy
reviewed
Apr 7, 2026
bluwy
approved these changes
Apr 13, 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.
When
server.hostis set to a specific IP (e.g.127.0.20.4) andstrictPort: true, Vite's port availability pre-check tests0.0.0.0and::. If any service holds the same port on a different interface, this wildcard check fails and Vite incorrectly aborts — even when the configuredhost:portis free.Changes
packages/vite/src/node/http.ts: InhttpServerStart, whenstrictPortis set and the wildcard pre-check fails, Vite now attempts to bind to the configuredhost:portdirectly before giving up. On success, a warning is emitted that another server may be running on a wildcard IP. OnEADDRINUSE, falls back to the existingstrictPortthrow.packages/vite/src/node/__tests__/http.spec.ts: Added tests covering:strictPort: trueallows binding when wildcard port is in use; warning is emitted in that case; error still thrown when the configured host port is also occupied.Example