4

So I'm trying to debug my server code without deploying it (which takes a long time).

I'm serving my website through angular (the framework doesn't matter IMO) ng serve --port 8080.

When I type http://localhost:8080 into the browser everything is fine and the website is loading.

192.168.1.39 is the address my router gave my laptop (I saw that on the router's admin configuration page).

When I type http://192.168.1.39:8080/ (localhost should be the same as this ip address!) it's the same message as on a phone connected to the same Wifi network(which is what I actually want-there's an issue when it comes to mobile phones images)- connection refused.

Following the debugging instructions here https://serverfault.com/questions/725262/what-causes-the-connection-refused-message

We can clearly see that on port 8080 ng is listening-

yoni@yoni-Lenovo-Z710:~/Projects/Server$ sudo netstat -tnlp | grep :8080
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      5879/ng

and I've completely disabled the firewall through

sudo ufw disable

restarted my laptop- still connection refused.

(I know it's not recommended but I really want figure things out and this became quite frustrating after a few hours).

On top of that I've tried ports other than 8080 (the default angular's 4200 for example).

Oh yeah, and I've tried to forward all the requests from ports 4000 to 9000 to my laptop (router configuration). Same result- connection refused ;)

What do i do? How do I debug this problem?

1 Answers1

4

Hello and welcome to AskUbuntu!

As you can see from netstat, your service is listening only on localhost:

tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      5879/ng
                    ^^^^^^^^^^^^^^

You should change your ng command to:

ng serve --host 0.0.0.0 --port 8080

so it will listen on port 8080 on all available IP/Interfaces on your machine.