Pengwin icon indicating copy to clipboard operation
Pengwin copied to clipboard

python http server unreachable

Open aborruso opened this issue 5 years ago • 14 comments

Hi, when I run python3 -m http.server I have Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/).

But If I open the http://0.0.0.0:8000/ or http://localhost:8000/ in the browser I have "connection failed" (below it's in Italian).

image

No problem to pinging it via shell. Could it be some win firewall setting? How to set it?

image

I'm using PENGWIN_VERSION="20.10.3"

WSL Version: 2
Locale: it_IT
Release Install Date: Wed Jun  3 16:19:27 CEST 2020
Branch: vb_release
Build: 19041
Full Build: 19041.1.amd64fre.vb_release.191206-1406
Display Scaling: 1
Windows Theme: light
Windows Uptime: 4d 3h 10m
WSL Uptime: 3d 1h 56m
WSL Release: Pengwin
WSL Kernel: Linux 4.19.104-microsoft-standard
Packages Count: 1021

Thank you

aborruso avatar Oct 19 '20 09:10 aborruso

Hello @aborruso ,

Try to connect to the WSL2 IP instead of localhost. Run ip address to get your IP. Then use this IP in your browser.

Regards, Carlos

crramirez avatar Oct 19 '20 10:10 crramirez

Hello @crramirez it works.

Do you have some tips to to automate it? Or do I must run everytime ip address to check my ip?

As usual thank you very much

aborruso avatar Oct 19 '20 10:10 aborruso

I have seen some scripts out there. I can find one and make a how-to guide or even include it in pengwin-setup

crramirez avatar Oct 19 '20 11:10 crramirez

It would be great, thank you

aborruso avatar Oct 19 '20 12:10 aborruso

In .wslconfig there's enable localhost forwarding. I think this scenario is what's enabled by enabling it.

WSLUser avatar Oct 21 '20 00:10 WSLUser

In .wslconfig there's enable localhost forwarding. I think this scenario is what's enabled by enabling it.

Do I must create .wslconfig file in ~ and add the below row?

enable localhost forwarding

aborruso avatar Oct 21 '20 12:10 aborruso

You create it in your Windows home user. See the WSL release notes. There's a template you can copy/paste. Change this option to true

WSLUser avatar Oct 21 '20 12:10 WSLUser

https://www.bleepingcomputer.com/news/microsoft/windows-10-wsl2-now-allows-you-to-configure-global-options/

crramirez avatar Oct 21 '20 22:10 crramirez

localhostForwarding= # Boolean specifying if ports bound to wildcard or localhost in the WSL2 VM should be connectable from the host via localhost:port (default true). Default is true :/

I've tried with hint from https://github.com/microsoft/WSL/issues/6114 but without success.

I've lost this forwarding after upgrading to WSL2. I needed docker integration :/ Any other hints?

kastoestoramadus avatar Mar 26 '21 14:03 kastoestoramadus

There's a WSL2 backend for Docker Desktop for Windows. If you enable that, do you still have an issue?

WSLUser avatar Mar 26 '21 15:03 WSLUser

There's a WSL2 backend for Docker Desktop for Windows. If you enable that, do you still have an issue?

As you wrote it is for WSL 2. Upgrading Pengwin to 2 creates connectivity with host problem.

kastoestoramadus avatar Mar 28 '21 11:03 kastoestoramadus

You have to enable it yourself. By default Docker uses Hyper-V/Moby VM.

WSLUser avatar Mar 28 '21 23:03 WSLUser

hello, some advance on this?

DevDorrejo avatar Feb 11 '22 04:02 DevDorrejo

hello, some advance on this?

Hello @DevDorrejo,

This discussion is quite long, so tell me what issue you are facing?

Regards, Carlos

crramirez avatar Feb 15 '22 21:02 crramirez