SMH, a lot of hours wasted on this due to lack of proper documentation and not everyone uses IIS... If anyone else is still stuck on this issue I hope this helps.
Solution: Trusted Self Signed SSL CERT for localhost on Windows 10
Note: If you only need the SSL cert follow the Certification Creation section
Stack: Azure Function App(Node.js), React.js - Windows 10
Step 1 - Create Certificate: OpenPowershell
and run the following:
New-SelfSignedCertificate -NotBefore (Get-Date) -NotAfter (Get-Date).AddYears(5) `
-Subject "CN=localhost" -KeyAlgorithm "RSA" -KeyLength 2048 `
-HashAlgorithm "SHA256" -CertStoreLocation "Cert:\CurrentUser\My" `
-FriendlyName "HTTPS Development Certificate" `
-TextExtension @("2.5.29.19={text}","2.5.29.17={text}DNS=localhost")
Step 2 - Copy Certificate: Open Certificate Manager
by pressing the windows key and search for "manage user certificates". Navigate to Personal -> Certificates
and copy the localhost cert to Trusted Root Certification Authorities -> Certificates
Trusted Root Certification Authorities -> Certificates
(Friendly Name will be HTTPS Development Certificate)
Step 3. Export Certificate right click cert -> All Tasks -> Export
which will launch the Certificate Export Wizard:
Certificate Export Wizard
Yes, export the private Key
Export private keyPersonal Information Exchange - PKCS #12
and leave the first and last checkboxes selected. Export formatStep 4. Restart Chrome
In this case we will run an Azure Function App with the SSL cert.
func start --useHttps --cert development.pfx --password 1111"
(If you used a different password and filename don't forget to update the values in this script)package.json
scripts to start your functions app:Install openssl locally, this will be used to convert the development.pfx
to a cert.pem
and server.key
. Source - Convert pfx to pem file
project-root/cert
)development.pfx
file in the cert folder. (project-root /cert/development.pfx
)openssl pkcs12 -in development.pfx -out cert.pem -nodes
openssl pkcs12 -in development.pfx -nocerts -out key.pem
openssl rsa -in key.pem -out server.key
.env.development.local
file by adding the following lines:SSL_CRT_FILE=cert.pem
SSL_KEY_FILE=server.key
npm start