No big revelation here, just writing this as a reminder to myself next time I try curl localhost
from WSL and it doesn't work:
- Don't use
localhost
or127.0.0.1
. Use your machine IP. But you shouldn't even need to figure this out. Usingyour-computer-name>.local
should work (egcurl Joshs-PC.local
. Even better:curl $(hostname).local
. - Make sure your server is listening on
0.0.0.0
, not127.0.0.1
.
Source: this excellent StackOverflow answer.
Top comments (0)