Search code examples
angularfirewalllanmacos-big-surlinksys

how to access localhost:4200 (Angular App) on Big Sur from another computer within the same lan?


screencapture : linksys port-forward table

My case is listed as below :

  • The client computer and the server computer are on the same lan where the wifi router is : linksys model#ea6200
  • The client computer can ping the server computer(where the server's OS is Big Sur 11.4 and its IP is 192.168.1.149)
  • The server is already listening to http://localhost:4200 , which is an Angular application .
  • But , when I type http://192.168.1.149:4200 in the client's browser, the site can’t be reached from the client's computer .
  • I have checked that the Big Sur's firewall is off.

My Question is :

  1. What else should be further set so that the site on the server computer can be reached from the client's computer ?
  2. Should I consider to make some configuration on the linksys port forwarding policy?

Thanks.


Solution

  • Answers from "NSteinbusch @ https://discord.davidbombal.com/ " :

    • this is an Angular issue rather than networking issue ;
    • by default angular only listen on local interface 127.0.0.1 ;
    • By using the following command on the command prompt ng serve --host 0.0.0.0, instead of simply typing ng serve to start the app, the client PC should be able to reach the Angular app of the server at http://192.168.1.149:4200/
    • By this method, the server will listen to all available interface, so your Ethernet NIC or Wi-Fi NIC as well.