如何在node.js的request/node fetch模块中通过https代理进行请求?

如何在node.js的request/node fetch模块中通过https代理进行请求?,node.js,request,fetch,Node.js,Request,Fetch,我正在尝试仅通过https代理服务器发出http(s)请求。但我得到了这个错误: : FetchError: request to https://google.com/ failed, reason: write EPROTO 17272:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332 我的代码: c

我正在尝试仅通过https代理服务器发出http(s)请求。但我得到了这个错误:

: FetchError: request to https://google.com/ failed, reason: write EPROTO 17272:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332
我的代码:

const fetch=require('node-fetch');
const HttpsProxyAgent=require('https-proxy-agent');
取('https://google.com', {
代理:新的HttpsProxyAgent('https://username@password@host:8000'),
})。然后(异步(res)=>{
log(wait res.text());
})
如果我使用
请求
模块进行设置并禁用
选项,则可以:

const request=require('request');
请求({
网址:'https://google.com',
代理:'https://username@password@host:8000',
pool:false//仅当此值为false时
},(误差、分辨率)=>{
console.log(err,res);//确定
})
如果我用
http
proxy协议做这个,它也可以


那么,我该如何修复它呢?我的程序需要支持
https
proxy,但我不知道怎么做。请求模块已弃用,我在产品中使用node fetch

您正在运行哪个版本的node.js?如果它很旧,可能需要更新。多年前就应该禁用SSLv3。使用node.js 14您运行的node.js版本是什么?如果它很旧,可能需要更新。多年前就应该禁用SSLv3了。使用node.js 14