H
H
hucuwe2020-07-06 08:51:08
Node.js
hucuwe, 2020-07-06 08:51:08

Net::ERR_CERT_COMMON_NAME_INVALID?

When the client side requests data from the server via https request, an error occurs:

GET https://ip:5001/api/cards/online net::ERR_CERT_COMMON_NAME_INVALID


config:

const env = {
    port: 5001
};

module.exports = env;


index.js:

const app = require('./app');
const https = require('https');
const config = require('./config/env');
const fs = require('fs');

https.createServer({
    key: fs.readFileSync('/etc/ssl/snkey.key'),
    cert: fs.readFileSync('/etc/ssl/sncrt.crt')
}, app).listen(config.port, () => {
    console.log(`Server has been started on ${config.port}`);
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2020-07-06
@dronmaxman

COMMON_NAME_INVALID is written that the client does not like the CN in the certificate (the CN does not match the domain name you are going to, in your case it is IP). When using IP in the address bar, no browser will consider such a connection to be trusted. Most likely all of it is self-signed. Add the "Ignore certificate verification" option on the client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question