Skip to content
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

Can ping $(localhost).local but cannot curl #11606

Closed
1 of 2 tasks
zeroarst opened this issue May 22, 2024 · 4 comments
Closed
1 of 2 tasks

Can ping $(localhost).local but cannot curl #11606

zeroarst opened this issue May 22, 2024 · 4 comments

Comments

@zeroarst
Copy link

zeroarst commented May 22, 2024

Windows Version

Microsoft Windows [Version 10.0.19045.4412]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu-20.04

Other Software

No response

Repro Steps

I built some APIs with NestJs on my Windows 10, and I want to test it in WSL2.
I can ping my localhost with either ip or name

$ ping "$(hostname).local"  // or $ ping 172.22.240.1
PING Roy-AMD-Ryzen7-3700X (172.22.240.1) 56(84) bytes of data.
64 bytes from Roy-AMD-Ryzen7-3700X (172.22.240.1): icmp_seq=1 ttl=128 time=0.135 ms
64 bytes from Roy-AMD-Ryzen7-3700X (172.22.240.1): icmp_seq=2 ttl=128 time=0.238 ms
64 bytes from Roy-AMD-Ryzen7-3700X (172.22.240.1): icmp_seq=3 ttl=128 time=0.222 ms

but when I do curl http://172.22.240.1:3000/stripe/foo, it does not work...
This command works in localhost..

C:\Users\zeroa>curl http://172.22.240.1:3000/stripe/foo
bar

curl does work for other domains.

$ curl google.com 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

networkingMode=mirrored it is not an option for me because I have to stick with Windows 10.
Please help!

Expected Behavior

Can curl from WSL2 to Windows 10 localhot on port 3000.

Actual Behavior

Failed to curl from WSL2 to Windows 10 localhot on port 3000.

Diagnostic Logs

WslLogs-2024-05-22_19-57-09.zip

@zeroarst zeroarst changed the title Can ping Windows with $(localhost).local but cannot curl Can ping $(localhost).local but cannot curl May 22, 2024
Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Copy link

Diagnostic information
Issue was edited and new log file was found: https://github.com/microsoft/WSL/files/15401506/WslLogs-2024-05-22_19-57-09.zip
.wslconfig found
Detected appx version: 2.1.5.0

Copy link
Contributor

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-file it as a new issue.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant