Invalid SSL Certificate Error 526

I have a website and a node js https server.
I set the encryption option to Flexible and the website works just fine with https, but when i go to the url and port of the node js https server it says "Invalid SSL certificate Error 526". I already tried to create an origin certificate and inclueded the private key as key option in the https options and the one above as cert option. Here a code snippet:
var options = {
    // add private.pem and public.pem
    key: fs.readFileSync('private.pem'),
    cert: fs.readFileSync('public.pem'),


};
const http = require('https', options);

What can i do to get the https (or more specific socket.io) working? I already tried so much.
Was this page helpful?