How to properly set up a Node.js HTTPS test for secure connections? or What's the best way to run a N

18 Replies, 1570 Views

Yep, ran into this too. The error’s usually about the cert chain. Try this:

```javascript
const https = require('https');
const fs = require('fs');

const options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem'),
ca: fs.readFileSync('ca.pem') // ← this part’s often missing
};
```

Make sure your `ca.pem` is in there. Node’s picky about the chain.

Messages In This Thread



Users browsing this thread: 1 Guest(s)