-
Hi there, I was attempting to add SSL to this boilerplate, but am seemingly having trouble connecting my frontend to the server, I'm getting a net::ERR_SSL_PROTOCOL_ERROR. Would someone be able to guide me on how to setup SSL for this boilerplate? Thanks in Advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For those looking for help on how to setup SSL with this boilerplate, this is what I did to get it working: In the index.js file: var https = require('https'); //SSL Files let server; mongoose.connect(config.mongoose.url, config.mongoose.options).then(() => { /*Changed this part so it's no longer setting the server object as app.listen call, but invoking the server to start listening */ }); |
Beta Was this translation helpful? Give feedback.
For those looking for help on how to setup SSL with this boilerplate, this is what I did to get it working:
In the index.js file:
var https = require('https');
var fs = require('fs');
//SSL Files
var httpsOptions = {
key: fs.readFileSync('./src/cert/privkey.pem'), //My path to the private key file
cert: fs.readFileSync('./src/cert/fullchain.pem'), //My path to the full chain file
ca: fs.readFileSync('./src/cert/chain.pem') //My path to the first chain file
}
let server;
server = https.createServer(httpsOptions, app); //This is where the server is initialized
mongoose.connect(config.mongoose.url, config.mongoose.options).then(() => {
logger.info('Connected to MongoDB');
/*Changed this part…