Run Angular CLI over HTTPS

It is very straight forward to run an Angular application over a secure https connection. Sometimes this can be a requirement for your application. For example, an API can require that all request must come from an HTTPS source.  There are many tutorials out there with detailed info on how this works. But I will focus on the basic to get you up and running on your development machine.

This solution should solve most problems or tasks about running your angular over HTTPS.

Let us start!

Enabling SSL

The easiest and fastest way is running your ng serve command or other commands with ssl = true.

ng serve –ssl true

That should do it!

Your browser will flag this connection as not trusted and you will get a warning. At this point you will have to manually trust this connection to by pass the warning page. To avoid this, you will need an actual cert and key.

Angular CLI provides us with three parameters we can pass along with the ng serve command to configure an SSL that can be trusted.

// enable or disable SSL
–ssl // path to root certificate
–ssl-cert // path to private key
–ssl-key

There still a lot of complexity involved but this should get you up and running on your local machine.

Enjoy!