A nodejs example of client-server https, using client certificates. The node server is behind nginx.
NOTE nginx itself requires and verifies the client certificate.
(as a bonus, there's also the recreateUrl
function for express behind proxies)
nginx -c $PWD/nginx-tls-proxy.conf
npm install
node server.js
curl -ik https://localhost:8443/ --cert ca/certs/client.crt --key ca/private/client.key
node client.js
- OpenSSL Certificate Authority (probably should not be used for production)
- HTTPS Authorized Certs with Node.js nice example of server side nodejs tls implementation, no nginx used here
- https module in nodejs docs
- tls module in nodejs docs for the connect options that https.request uses too
- x509 node package
- nginx ssl_verify_client