W
W
Wasya UK2017-07-31 10:20:30
Node.js
Wasya UK, 2017-07-31 10:20:30

Why is my https unreliable?

In the process of learning Node.js + HTTPS, I came across a problem, it finally worked, but the browser thinks that the certificate is untrustworthy. With what this problem can be connected (in this question I am 0).

Here is the code:

const express = require('express');
const app = express();
const fs = require('fs');
const port = process.env.PORT || 4300;

let frontpage = require('./routes/frontpage');

app.use('/', frontpage);

const https = require('https');
const httpsOptions = {
  passphrase: 'anohana',
  key: fs.readFileSync('./server.key', 'utf8'),
  cert: fs.readFileSync('./server.crt', 'utf8')
};
const server = https.createServer(httpsOptions, app);

server.listen(port, () => {
  console.log(`Server work on port ${port}...`);
});


Result:
a9028dc434a74db78097da1095830539.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question