Exposing a port from in WSL2 to back Windows
andyneff opened this issue · 4 comments
andyneff commented
Unless I'm missing something, is there a clever workaround to expose a port on WSL2 while WSL-VPNkit is active?
Example
In WSL2:
python3 -m http.server
In windows:
curl http://???/
Note: IPv6 works, but that's not using WSL-vpnkit, that's just a side that on my VPN, IPv6 apparently still works even without WSL-vpnkit
andyneff commented
Weird, today when I try localhost, it works. confused Oh well.
michaelakin commented
localhost did not work for me. Any other ideas?
andyneff commented
@michaelakin Running this in WSL2:
python3 -m http.server --bind 127.0.0.1 8001
Outputs:
$ python3 -m http.server --bind 127.0.0.1 8001
Serving HTTP on 127.0.0.1 port 8001 (http://127.0.0.1:8001/) ...
127.0.0.1 - - [13/Jul/2022 08:25:32] "GET / HTTP/1.1" 200 -
When I run this on the windows host from command prompt:
curl http://localhost:8001
I'm on VPN just now when I tested it.
A common issue would be your firewall/antivirus software is blocking it.