web page is https, but the node service of the backend or http has not been upgraded, so the ip port browser requesting http at the front end will report an error.
then follow the steps to upgrade the node service to https
https://itnext.io/node-expres.
node code is fine. Start and run ok
const express = require("express");
const app = express();
const https = require("https")
const http = require("http")
const fs = require("fs")
const bodyParser = require("body-parser")
const jwt= require("jsonwebtoken");
const expressJwt = require("express-jwt");
//
const privateKey = fs.readFileSync("/etc/letsencrypt/live/xxxx.xxx/privkey.pem", "utf8");
const certificate = fs.readFileSync("/etc/letsencrypt/live/xxxx.xxx/cert.pem", "utf8");
const ca = fs.readFileSync("/etc/letsencrypt/live/xxxx.xxx/chain.pem", "utf8");
const credentials = {
key: privateKey,
cert: certificate,
ca: ca
};
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
//httphttps
var PORT = 3001;
var SSLPORT = 3002;
//http
httpServer.listen(PORT, function() {
console.log("HTTP Server is running on: http://localhost:%s", PORT);
});
//https
httpsServer.listen(SSLPORT, function() {
console.log("HTTPS Server is running on: https://localhost:%s", SSLPORT);
});
but the front end is changed to https://172.XXX.XXX.XXX:3002 browser will report an error, but there is no problem with postman
iphttps://www.xxx.com:3002
chromesecurity