Access your angular2 dev environment from VPN without remote desktop

  • fennng 
Sometimes, Remote desktop is quite slow, access angular2 directory from a browser may be better.
By default, ng serve only bind to, which means the http port can only be accessed by local machine.
To allow connection from other machines, use the following command to allow all connections.
ng serve –host
Now, you will be able to access your angular2 app using ip address (e.g. from another machine. But it may not work properly. because your debug settings has all the config pointing to localhost,  your anguar2 app will make api calls to your backend using localhost rather than your ip address. To solve this problem, we can use Fiddler.
Go to Fiddler’s Tools->Hosts, map localhost to your dev machine’s ip address
Inline image 4
Inline image 2
Make sure you enable capturing
Inline image 3
And also make sure your proxy setting doesn’t bypass localhost
Inline image 5
Inline image 1
That’s all, you are ready to go. Use localhost:4200 to access your dev angular2 app from another PC.  Because all HTTP traffic will go through fiddler, fiddler will forward all localhost traffic to your dev machine including api calls.
Next post, I will show you how to edit angular2 source code without a remote desktop.


您的电子邮箱地址不会被公开。 必填项已用*标注