microsoft / microsoft/WSL

Localhost relay does not support dual-mode sockets

Open
#4,851 46 comments 21 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature network
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.19551.1005]

What you're doing and what's happening:

I am trying to start-up a webserver and have it listen on a specific port. Then when I try to reach this website using a service like localtest.me it says it's unreachable, this is specifically happening when I try to run shadow-cljs on WSL2. If I run it on a WSL distro it works fine. After some talking with the author of that package I was able to boil down a reproducible issue to:

  1. In a fresh instance of Ubuntu with WSL2 enabled run nc :: 8080 -l
  2. Try to connect to nc, on Windows with any browser, at the address 127.0.0.1:8080.
What's wrong / what should be happening instead:

When opening up a server and telling it to listen on '::' and port 8080, the server becomes unreachable on the Windows side when trying to access it through a browser on 127.0.0.1:8080. However, the server is reachable through the browser when accessing it through localhost:8080. This workflow used to work on WSL1. I have tested this on a multitude of ports and it never works.

Additionally, this works fine if I use nc 0.0.0.0 8080 -l instead. It is reachable by browser on 127.0.0.1 and localhost.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by reproducing the issue with WSL2 Ubuntu using nc :: 8080 -l and compare it with nc 0.0.0.0 8080 -l, then trace the localhost relay and dual-mode socket handling. Done means a server bound to :: on port 8080 is reachable from Windows through both 127.0.0.1:8080 and localhost:8080.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.