Hello everyone,
I’m new to Cloudflare, and I just secured my domain with CF’s ssl certificate. And it works well!
I still have a problem though, I have a NodeJS application that runs in my server and the certificate I generated doesn’t work well for it.
It still gives me that the API is not secure and I have to go with (Advanced => Proceed to --------- (unsafe)) on Google Chrome and other browsers.
Here’s a peak on my code.
const privateKey = fs.readFileSync(“/etc/ssl/private/key.pem”, “utf8”); //CF’s SSL key
const certificate = fs.readFileSync(“/etc/ssl/certs/cert.pem”, “utf8”); //CF’s SSL cert
let credentials = { key: privateKey, cert: certificate };
let httpsServer = https.createServer(credentials, app);
httpsServer.listen(PORT, () => {
console.log(HTTPS started on port ${PORT}
);
});
My APIs have to be secure too in order to communicate with the Frontend. It should be similar to that : https://0.0.0.0:port/api/request
PS: My server is on DigitalOcean, using Ubuntu as a OS, and NGINX.
Thanks for your help!