Answer the question
In order to leave comments, you need to log in
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}...`);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question