0

I have written an angular website on Windows 10, and am trying to view it from a browser on another machine using my machine's IP address.

As per instructions in How to allow access outside localhost I am invoking this with

ng serve --host 0.0.0.0

It now allows access from the local machine, via URL http://192.168.1.252:4200/ but when I call the same URL from another machine on the same network it just times out and doesn't return anything. I have tried:

  • Opening the port 4200 for incoming for all applications in the firewall settings
  • Logging incoming requests using Microsoft Network Monitor. The incoming requests are seen, and of the format:

    TCP:[SynReTransmit #9044]Flags=......S., SrcPort=47752, DstPort=4200, PayloadLen=0, Seq=608863266, Ack=0, Win=65535 ( Negotiating scale factor 0x7 ) = 65535

but none of these solutions has worked. It's still doing the same thing. Do I need to set anything in my angular.json or package.json? I'm quite stumped. Thanks.

Stephen Holt
  • 2,360
  • 4
  • 26
  • 34
  • 1
    You need to set `host` to local IP address: `ng serve --host 192.168.1.252` – Harun Yilmaz Mar 14 '19 at 13:06
  • @HarunYılmaz that doesn't work I'm afraid, it's just doing the same thing. I believe that 0.0.0.0 is a sort of general catch-all for all IP addresses anyway, so it should be working either way. – Stephen Holt Mar 14 '19 at 13:13
  • Have you checked the chrome browser logs on the other machine? – Mike Tung Mar 14 '19 at 13:16
  • @MikeTung I've had a look, but can't see anything that looks very revealing. There are entries saying NetworkDelegate::NotifyBeforeUrlRequest but that's about it – Stephen Holt Mar 14 '19 at 13:26
  • it's not really a [reproducible problem](https://stackoverflow.com/help/mcve) that we can help you with it seems.. – Mike Tung Mar 14 '19 at 13:28
  • OK, I've made some breakthrough - I switched from using my normal router to using my phone as a mobile hotspot, and suddenly everything works. Therefore assuming that the issue is something to do with the router settings. Will investigate more later, but thanks to above commenters for their help. – Stephen Holt Mar 14 '19 at 13:44

1 Answers1

0

Your Network Adapter is propably configured as "Public".

A Public network is apt for social locations like airport lounges and coffee shops with public Wi-Fi hotspots. Other devices on the network can’t see your computer, and file and printer sharing are turned off. Windows is stricter with security on public networks.

To change this, right click on your network connection in the tray menu and select properties. Change profile to private.

Or

Press [Win]+[I] to open Windows settings and navigate to "network"->"status"->"properties" (of your network connection). Change profile to private.

After that i was able to open my served angular project from other devices in the same network.