设置Angular程序的ng serve启用HTTPS的步骤:

  1. Clone Github repo
git clone https://github.com/RubenVermeulen/generate-trusted-ssl-certificate.git --depth=1
  1. Open PowerShell or Command Prompt, run scripts below:
    cd generate-trusted-ssl-certificate
    bash generate.sh
    
  2. Import the cert file by double click the generated crt file.

MUST move to the ‘Trusted certification’ folder.

  1. Set script to run ‘ng serve’ to support SSL:
ng serve --ssl true -o --sslKey ssl/server.key --sslCert ssl/server.crt

是为之记。
Alva Chien
2020.10.17