我尝试了数百次并使用 axios 代理但它不起作用
任何人都可以解释一下问题是什么吗? 我将删除一个简单的代码来解释问题
const axios = require('axios');
// Make the GET request with Axios and the proxy agent
axios.get('https://ip.smartproxy.com', {
proxy: {
host: '185.122.168.215',
port: 34991
// no need to user and password cuz i already in the whitelist
// i tryied free proxy and its not work
}
})
.then(response => {
console.log('Response:', response.data);
})
.catch(error => {
console.error('Error:', error);
});
我真的尝试了一切,但我不知道该怎么办 输出是:
cause: Error: write EPROTO B4370000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:355:
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
errno: -4046,
code: 'EPROTO',
syscall: 'write'
}
}
也许您必须像 axios 文档一样将协议定义到代理选项中。
https://axios-http.com/docs/req_config
我在其他链接中查看了此错误,@Patrick Mevzek 建议这样做:
如果您尝试使用 HTTPS 通信,通常会出现此错误消息 不是 HTTPS,而是更多 HTTP 的东西。