requests proxy 不支持https吗?
这样写代码是没错的,代理的IP是有效的,支持HTTP,也支持HTTPS
const request = require('request');
let proxyUrl = 'http://119.117.29.15:8943';
request.get({
url : 'https://pv.sohu.com/cityjson?ie=utf-8',
proxy: proxyUrl
}, (err, rep, body) => {
console.log(err);
console.log(body);
});
但是如果我将请求的proxy修改成https,就不行了,请问怎么解决
let proxyUrl = 'https://119.117.29.15:8943';
报错如下:
{ Error: tunneling socket could not be established, cause=Client network socket disconnected before secure TLS connection was established
at ClientRequest.onError (/Library/WebServer/Documents/html/info.zhaoyaojing.client_node/node_modules/_tunnel-agent@0.6.0@tunnel-agent/index.js:177:17)
at Object.onceWrapper (events.js:273:13)
at ClientRequest.emit (events.js:182:13)
at TLSSocket.socketErrorListener (_http_client.js:375:9)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19) code: 'ECONNRESET' }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTTPS需要证书来证明域名,IP是不会有证书的。所以你的代理使用https是无法正常工作的