Detect TLS Version in Node Express App?

2019-07-29 19:02发布

问题:

Is it possible to detect the TLS version 1.1 or 1.2 etc in Node Express application.

回答1:

If your are using express you can try with:

app.get('/', (req, res, next) => {
  if (req.protocol === 'https')
    console.log(req.connection.getProtocol());
  else
    console.log('Not SSL');
});