Reputation: 317
I am unable to use HTTPS and send the index.html to the client.
Nodejs code:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var fs = require('fs');
var https = require('https');
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem'),
rejectUnauthorized: false
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(443);
https.get('/', function(request, response){
response.sendFile('/home/ubuntu/index.html');
});
I get this error, should I be calling options in the https.get function?
`events.js:72
throw er; // Unhandled 'error' event
^
Error: DEPTH_ZERO_SELF_SIGNED_CERT`
Upvotes: 0
Views: 1218
Reputation: 317
have you tried process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; – Maverick976
Upvotes: 1