Skip to content

Adds support for proper localhost loopback on RFC 6761 #256617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2025

Conversation

timheuer
Copy link
Member

Fixes #256611

  • πŸ” Added TLD matching for localhost variations
  • βœ… Updated tests to cover new localhost cases

The solution follows RFC 6761 standards where .localhost is a special-use top-level domain reserved for loopback purposes. The regex pattern ^(.+.)?localhost(:\d+)?$ matches:

localhost (the base domain)
*.localhost (any subdomain of localhost)
Optional port numbers (e.g., :3000, :8080)
Case-insensitive matching

Now when you encounter links ending with dev.localhost or any other *.localhost subdomain, VS Code will automatically trust them and won't prompt you to configure trusted domains or ask if you want to open the external website. This provides the same seamless experience as localhost itself, which aligns with the RFC 6761 specification that treats the entire .localhost TLD as reserved for local loopback testing.

- πŸ” Added TLD matching for localhost variations
- βœ… Updated tests to cover new localhost cases
lramos15
lramos15 previously approved these changes Jul 18, 2025
@vs-code-engineering vs-code-engineering bot added this to the July 2025 milestone Jul 18, 2025
rzhao271
rzhao271 previously approved these changes Jul 18, 2025
@timheuer timheuer dismissed stale reviews from rzhao271 and lramos15 via 914937e July 21, 2025 14:47
@lramos15 lramos15 merged commit 9e37f46 into microsoft:main Jul 21, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VS Code treats *.localhost addresses as external websites
6 participants