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't connect to linux localhost from Windows browser #2471

Open
programmylife opened this Issue Sep 5, 2017 · 11 comments

Comments

Projects
None yet
6 participants
@programmylife

programmylife commented Sep 5, 2017

I am trying to run two localhost applications (not at the same time) in bash on Ubuntu on Windows: flask and jekyll. I'm starting the services from the bash on Windows terminal using 'jekyll serve' and 'python -m flask run'. In both cases I copy and paste the localhost address printed to the terminal (127.0.0.1:5000, and 127.0.0.1:4000, respectively) to a browser on Windows 10, and get 'This site can't be reached'.

Edit: I have installed flask on windows and am able to run and access a local server from the Windows command line as expected (but still not bash).

I have tried upgrading to the newer version of Ubuntu (uninstalled and reinstalled to go from v14 to v16) as well as creating a firewall rule for the bash.exe file on Windows Defender.

Microsoft Windows build number [Version 10.0.15063]

@gravcat

This comment has been minimized.

Show comment
Hide comment
@gravcat

gravcat Sep 8, 2017

If you telnet to that port from within the Linux SubSystem does it connect, or fail?

telnet localhost 5000
telnet localhost 4000

gravcat commented Sep 8, 2017

If you telnet to that port from within the Linux SubSystem does it connect, or fail?

telnet localhost 5000
telnet localhost 4000

@programmylife

This comment has been minimized.

Show comment
Hide comment
@programmylife

programmylife Sep 8, 2017

Fails. I tried it in a separate window and the same window (both bash).

programmylife commented Sep 8, 2017

Fails. I tried it in a separate window and the same window (both bash).

@gravcat

This comment has been minimized.

Show comment
Hide comment
@gravcat

gravcat Sep 8, 2017

If it doesn't work in bash it makes me think you have a firewall restriction of some sort, can you try just blanket rule shutting the firewall off to see? Also do sudo ufw status to make sure Ubuntu isn't running a firewall.

gravcat commented Sep 8, 2017

If it doesn't work in bash it makes me think you have a firewall restriction of some sort, can you try just blanket rule shutting the firewall off to see? Also do sudo ufw status to make sure Ubuntu isn't running a firewall.

@programmylife

This comment has been minimized.

Show comment
Hide comment
@programmylife

programmylife Sep 8, 2017

programmylife commented Sep 8, 2017

@programmylife

This comment has been minimized.

Show comment
Hide comment
@programmylife

programmylife Sep 11, 2017

Disabling the Windows Defender Firewalls didn't work. Trying to run 'sudo ufw status ' gave me an error:

ERROR: problem running iptables: iptables v1.6.0: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

programmylife commented Sep 11, 2017

Disabling the Windows Defender Firewalls didn't work. Trying to run 'sudo ufw status ' gave me an error:

ERROR: problem running iptables: iptables v1.6.0: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

@gravcat

This comment has been minimized.

Show comment
Hide comment
@gravcat

gravcat Sep 12, 2017

Silly question, but if you do ps -ef | grep python do you see the apps running and not in a failed state? Can you check your logging to confirm it's working properly?

Perhaps the problem is simpler than we think...

gravcat commented Sep 12, 2017

Silly question, but if you do ps -ef | grep python do you see the apps running and not in a failed state? Can you check your logging to confirm it's working properly?

Perhaps the problem is simpler than we think...

@programmylife

This comment has been minimized.

Show comment
Hide comment
@programmylife

programmylife Sep 12, 2017

'acmshar 12 2 10 07:44 tty1 00:00:00 python -m flask run'

So it appears to be running.

programmylife commented Sep 12, 2017

'acmshar 12 2 10 07:44 tty1 00:00:00 python -m flask run'

So it appears to be running.

@hybridtechie

This comment has been minimized.

Show comment
Hide comment
@hybridtechie

hybridtechie Sep 14, 2017

Hi

I am trying to get Memcached running on WSL and try to access it via the port in Windows browser.
It says Could not open port.
I am getting the same error when trying to sudo ufw status
I am also facing the same issue and python seems to be running.

hybridtechie commented Sep 14, 2017

Hi

I am trying to get Memcached running on WSL and try to access it via the port in Windows browser.
It says Could not open port.
I am getting the same error when trying to sudo ufw status
I am also facing the same issue and python seems to be running.

@matteocontrini

This comment has been minimized.

Show comment
Hide comment
@matteocontrini

matteocontrini Sep 22, 2017

Same here with a Node.js HTTP server.

winver => 15063.608

I think this is a duplicate of #1498

matteocontrini commented Sep 22, 2017

Same here with a Node.js HTTP server.

winver => 15063.608

I think this is a duplicate of #1498

@Wvvi

This comment has been minimized.

Show comment
Hide comment
@Wvvi

Wvvi May 7, 2018

This is a problem that bothers me, too,Would you like to have a solution?

Wvvi commented May 7, 2018

This is a problem that bothers me, too,Would you like to have a solution?

@karenyyng

This comment has been minimized.

Show comment
Hide comment
@karenyyng

karenyyng May 26, 2018

WSL runs via Docker like technology and has the same restrictions.
You have to point your web app inside the WSL to use the IP ‘0.0.0.0’ and then you can see the app in a browser at 127.0.0.1

karenyyng commented May 26, 2018

WSL runs via Docker like technology and has the same restrictions.
You have to point your web app inside the WSL to use the IP ‘0.0.0.0’ and then you can see the app in a browser at 127.0.0.1

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