0

I have generated a self-signed certificate and I am using it with Node.js with

const httpsOptions = {
  key: fs.readFileSync('./key.pem'),
  cert: fs.readFileSync('./cert.pem')
};

const server = https.createServer(httpsOptions, app).listen(app.get('port'), () => {
  console.log('Server listening on port %d in %s mode', app.get('port'), app.get('env'));
});

I am able to access https://localhost:3000, but Chrome says that the url is 'Not Secure'. I have tried to make Chrome trust the certificate by first adding the certificate to Keychain Access in Mac OSX and then clicking it to say "Always Trust" in "When using this certificate", but it keeps saying that the URL is not secure.

Edit

I have followed many different tutorials to make Chrome trust my self-signed certificate.

I have added the certificate in Keychain Access (both to login and System). I have updated the certificate to tell the OS to always trust the certificate.

I have restarted my computer, Chrome, and Node.js server, but it still says that the connection is not secure.

I have no idea what I have done wrong.

Edit 2

It says that the certificate is trusted, so it might be configured wrong.

enter image description here

Jamgreen
  • 8,491
  • 24
  • 79
  • 186
  • Possible duplicate of [Getting Chrome to accept self-signed localhost certificate](https://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate) – Adaline Simonian Jul 29 '17 at 20:19
  • I have also followed instructions in this question, but it is still not secure – Jamgreen Jul 30 '17 at 07:11
  • Interesting. What does Chrome say about the certificate in the security panel in devtools? – Adaline Simonian Jul 30 '17 at 07:13
  • It says both `There are issues with the site's certificate chain (net::ERR_CERT_COMMON_NAME_INVALID).` and `The certificate for this site does not contain a Subject Alternative Name extension containing a domain name or IP address.`. My common name is `localhost` and I'm visiting localhost at `https://localhost:3000` – Jamgreen Jul 30 '17 at 07:24
  • Ah, looks like you're running into this: https://stackoverflow.com/a/42917227/4220785 – Adaline Simonian Jul 30 '17 at 07:35

0 Answers0