Chris Straw
SHARE:

Angular using ssl on localhost

Example Repo:
https://github.com/chrisstraw/angular-ssl

Requirement: you must have OpenSSL installed. I do this through https://chocolatey.org/

1. To generate the key and crt files, open a terminal in certs and run. Once they are generated, I commit these files to the repo

 
openssl req -new -x509 -newkey 1rsa:2048 -sha256 -nodes -keyout localhost.key -days 3560 -out localhost.crt -config certificate.config.txt

2. Change the server to include the ssl flag

 
ng serve app-example-one --port 4321  -o --ssl true --ssl-key .\\certs\\localhost.key --ssl-cert .\\certs\\localhost.crt

3. You will receive the ssl connection error.

image

4. You have to import the crt file into the Trusted Root Certification Authorities

image

image

image

image

image