Generate a certificate
git clone https://github.com/RubenVermeulen/generate-trusted-ssl-certificate.git
cd generate-trusted-ssl-certificate
bash generate.sh
You should now have a server.crt and a server.key file in the repository folder.
Install the certificate (MacOS)
- Double click on the certificate (server.crt)
- Select your desired keychain (login should suffice)
- Add the certificate
- Open Keychain Access if it isn’t already open
- You should see the certificate localhost, double click it
- Expand Trust tab
- Select the option Always Trust in When using this certificate
- Close the certificate window
Configure the application
create a ssl folder in applciation
angular-app: - e2e - src - ssl .angular-cli.json
Copy the private key and root certificate from step 1 into the ssl folder. Make sure the file names are like this:
server.key (private key)
server.crt (root certificate)
Update package.json:
"start": "ng serve --ssl --ssl-key ./ssl/server.key --ssl-cert ./ssl/server.crt",
Run:
npm start