4

I've been running ng serve --ssl on my current project for some time with no issue. The first time I ran it, angular automatically created a self-signed cert. My browser rejected it which is expected, so I exported it and imported it into my local trusted root certificates and turned on the Chrome flag chrome://flags/#allow-insecure-localhost to allow me to use untrusted certs from localhost. So all was well for a while.

Today I'm running ng serve --ssl and I'm getting the following error:

"Your connection is not private"

"NET::ERR_CERT_DATE_INVALID"

After inspecting the cert, sure enough, the cert has expired.

How do I get ng serve --ssl to create a new cert and stop using the old expired one? I've already tried deleting the old expired one in my local cert management console but the same old expired cert is re-used whenever I run ng serve --ssl

Post Impatica
  • 13,089
  • 7
  • 58
  • 69

1 Answers1

12

Apparently the Angular CLI only creates a 1 month certificate when it autogenerates a cert. I downloaded and used Micrsoft's SysInternals ProcessMonitor to find the fix.

  1. Stop ng serve --ssl if it's still running
  2. Delete node_modules\webpack-dev-server\ssl\server.pem
  3. Restart ng serve --ssl and you should have a new 30 day cert.
Post Impatica
  • 13,089
  • 7
  • 58
  • 69