Problem using lets encrypt certificate with node

Great!

Make sure you are passing the full certificate chain to Node, not just the leaf certificate. Otherwise some non-browser clients like curl may fail to validate the certificate.

Your server is currently not sending the CA bundle (full chain), just the leaf.

The minimum successful usage is usually like this:

const https = require('https')
const fs = require('fs')

const server = https.createServer({
  cert: fs.readFileSync('/etc/letsencrypt/live/example.org/fullchain.pem'),
  key: fs.readFileSync('/etc/letsencrypt/live/example.org/privkey.pem')
})

server.listen(3131, () => {
  console.log('Started')
})
2 Likes