I have an angular 4 and a node app. I connect them with HTTP services. now I put them on a local server with 192.168.x.y IP. I start my angular app by:
ng serve --port 8080 --host 192.168.x.y --public 151.233.t.z
which 151.233.t.z is my public IP. and finally, I run my apps by: pm2 start npm -- start
and pm2 start index.js
.(my node server is listening on port 3000) and in the HTTP services I send my HTTP request to http://192.168.x.y:3000
. when I open the browser on 151.233.t.z:8080 on a local system everything is ok. but when I try outside the network I just can see my angular app and when I click on a button to send post request for login, it's not working!
Asked
Active
Viewed 504 times
0

fariba.j
- 1,737
- 7
- 23
- 42
-
Try use ngrok it will host your 80 port outside network https://ngrok.com/ – Manoj Jadhav Jul 11 '18 at 07:54
-
@ManojJadhav but I didn't use port 80! I don't understand what is the problem!! I think I cant access 192.168.x.y:3000 from 151.233.t.z:8080 – fariba.j Jul 11 '18 at 07:56
-
Did you see any error in browser.? (check in Network tab) – Manoj Jadhav Jul 11 '18 at 07:58
-
Why do you expect it to work outside of your network. Your IP is not a public IP – vibhor1997a Jul 11 '18 at 07:58
-
@ManojJadhav yes when my angular app finished loading i see some `GET http://151.233.t.z/sockjs-node/info?t=1531295911743 0 ()` and '[WDS] Disconnected!' – fariba.j Jul 11 '18 at 08:00
-
@vibhor1997a whell i know it's not public! i don't know how to solve it and i wanna know is this the problem that doesnt let me login from another network? – fariba.j Jul 11 '18 at 08:02
-
For it to work publicly you need to do port forwarding and most probably its illegal then you can access the server on your public IP. Or just use a hosting service to host your server publicly. – vibhor1997a Jul 11 '18 at 08:05
-
@vibhor1997a well, I cannot use a hosting service! how should I do port forwarding? I opened port 3000 and 8080 on 192.168.x.y! what else should I do? – fariba.j Jul 11 '18 at 08:09
-
@ManojJadhav can't you help me? I don't know what to do yet!! – fariba.j Jul 11 '18 at 10:19
-
@fariba.j I am not understand what your doing. but any way you can use ngrok with any port not only 80. Please try it. – Manoj Jadhav Jul 11 '18 at 11:26