This page focuses on how to run your Angular application locally, during the development phase.
The following command will compile and re-compile live each time you update the code, plus this will be accessible from anywhere in your network (think about allowing ingress traffic, on your Windows firewall, for port 4200) with some additions:
- –host set to 0.0.0.0 will allow any device on the network to access your server
- –public-host set the URL you wanna access your app with, when using a reverse proxy (and I do)
ng serve --host 0.0.0.0 --public-host https://core-dev.fevio.fr/
As we are going to work with tokens, authentication, and service workers, we are going to need HTTPS. If not already done, you should configure your reverse proxy for a dev URL. Here we are going to use:
- https://core-dev.fevio.fr
This will allow us to access our application from any local device (192.168.1.0/24) using a proper domain name, saving us headache caused by a lack of HTTPS.
For security purpose, I have added the following lines to limit this access only to local devices (this is specific to my architecture and written here as a reminder)
location / {
# allow subnet 192.168.1.0/24
allow 192.168.1.0/24;
# drop the rest
deny all;
}