Phone cannot access sites being served by localhost(lite-server) on same WiFi network

764 Views Asked by At

Searched all over the place for a fix for this or even a good way to troubleshoot it. I've read the previous SO threads that seem to cover this issue but nothing in any of them has worked in my case. Basically, I can't get access to anything that is being served via localhost on my mac in any browser on my Android device.

This is happening despite the fact they are connected to the same WIFI network and I am using the correct network address for my mac on which localhost is running (I have checked and double checked several times). I have no idea what the problem is because it worked perfectly fine before and I haven't changed anything that I believe would interfere with localhost access.

I don't have firewall or port blocking settings on my router either.

I have also tried on several different Android devices to eliminate it being a problem specific to one particular device.

Totally stumped. Any clues or hints on how to fix this would be much appreciated!

***** UPDATE *****

I tried using python -m SimpleHTTPServer 3000and it works. The site is accessible on my Android device. So I am pretty sure it is not a network issue per se.

The site is essentially a Node app which I built using the angular-quickstart template found here. It launches lite-server when npm start is run. Hope that gives some further insight into what the problem might be.

1

There are 1 best solutions below

10
On

If you open up a terminal on your mac and then run the command ifconfig it will tell you what ip address all your interfaces have. It is probably your en0 interface. That ip address should be used in your browser on your Android device.

You will have to make user that you server (web) is binding to the correct ip address as well. You could be binding to all ip addresses if possible.