Add IPv6 loopback hosts entry for custom domains to fix slow .local DNS on macOS - #3912
Merged
Conversation
…NS on macOS Write a ::1 entry alongside the 127.0.0.1 entry so macOS doesn't stall on an IPv6 lookup timeout when resolving .local domains, which could add several seconds to every request. Existing sites are migrated to add the IPv6 entry the next time they start. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
📊 Performance Test ResultsComparing 5480e44 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
Contributor
|
I couldn't notice any difference either, but the fix seems reasonable and harmless. |
wojtekn
approved these changes
Jun 22, 2026
Contributor
Author
|
I noticed local does the same as well. |
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.
Related issues
How AI was used in this PR
Claude Code investigated the reported
.localslowdown, located the hosts-file logic, implemented the IPv6 entry plus the migration path for existing sites, and wrote the tests. The author reviewed the diff and reasoning.Proposed Changes
On macOS, resolving a
.localcustom domain that only has an IPv4 entry in the hosts file can stall on an IPv6 (AAAA) lookup that has to time out before the IPv4 result is used — adding several seconds to every request for affected users (see #3655). This writes a matching::1loopback entry alongside the existing127.0.0.1entry for each custom domain, which is the standard remedy for this behavior.Users with existing custom-domain sites are migrated automatically: the IPv6 entry is added the next time the site starts. Already-correct entries are left untouched, so no spurious elevated-permission prompt appears on startup.
The slowdown is environment-dependent (the linked issue tags it as affecting "Some (< 50%)" of users), but the extra entry is harmless for unaffected users and is the cure for those who hit it.
Testing Instructions
On a macOS machine that exhibits the slowdown:
.localdomain.time curl -sI http://your-domain.local/ > /dev/null— note the time./etc/hostsnow contains both127.0.0.1 your-domain.localand::1 your-domain.localinside the# BEGIN/END WordPress Studioblock.curlcommand — the time should drop substantially.::1line).Pre-merge Checklist