最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Force setting TLS vresion 1.2 when sending out a request from Node.JS to DocuSign - Stack Overflow

programmeradmin0浏览0评论

We are having difficulty sending a request through a corporate proxy from our Node.JS application to DocuSign (demo.docusign and account-d.docusign)/ We've identified that the issue is possibly due to the DocuSign server accepting TLS 1.1 and 1.2 only.

Is there any way to force set the TLS version to TLS 1.2 for requests? If there are any request modules (axios, got, request) that supports this and if there are code examples it would be very helpful.

Thanks alot in advance!

We are having difficulty sending a request through a corporate proxy from our Node.JS application to DocuSign (demo.docusign and account-d.docusign.)/ We've identified that the issue is possibly due to the DocuSign server accepting TLS 1.1 and 1.2 only.

Is there any way to force set the TLS version to TLS 1.2 for requests? If there are any request modules (axios, got, request) that supports this and if there are code examples it would be very helpful.

Thanks alot in advance!

Share Improve this question asked Aug 7, 2020 at 7:04 NakakapagpabagabagHmNakakapagpabagabagHm 6331 gold badge7 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

You can specify the min and max TLS version to use by setting tls.DEFAULT_MAX_VERSION and tls.DEFAULT_MIN_VERSION.

This should then apply to any module that uses the core Node.js TLS code.

For example:

const axios = require("axios");
const tls = require("tls");

tls.DEFAULT_MIN_VERSION = "TLSv1.1";
tls.DEFAULT_MAX_VERSION = "TLSv1.3";

async function testTLSVersion() {
    let response = await axios({ url: "https://httpbin/get"});
    console.log("TLS Version of connection:", response.request.connection.getProtocol());
}

testTLSVersion();

Here we connect to an https server and log the TLS version of the connection. You can play about with the MIN and MAX TLS versions to see how it affects the protocol used.

发布评论

评论列表(0)

  1. 暂无评论