尝试在 Node.js/Puppeteer 中使用代理服务器时出错 [英] Getting error when attempting to use proxy server in Node.js / Puppeteer
本文介绍了尝试在 Node.js/Puppeteer 中使用代理服务器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在我的 Node.js/Puppeteer 应用程序中使用代理并收到错误.
I am attempting to use a proxy within my Node.js / Puppeteer application and receiving errors.
如果我删除代理代码,应用程序将按预期运行.
If I remove the proxy code, the application runs as intended.
const browser = await puppeteer.launch({args: ['--proxy-server=socks5://127.0.0.1:9050'], headless: false});
我希望应用程序能像往常一样运行,但使用不同的 IP.
I expect the application to run as usual, but with a different IP.
收到错误:ERR_PROXY_CONNECTION_FAILED
Error received: ERR_PROXY_CONNECTION_FAILED
推荐答案
要么您的代理不起作用,要么 puppeteer 拒绝它,因为它很可能使用自签名证书.要修复证书问题,请添加以下参数.
Either your proxy is not working or puppeteer is rejecting it because it is most likely using a self-signed cert. To fix a cert issue add the following args.
args: [
'--proxy-server=socks5://127.0.0.1:9050'
'--ignore-certificate-errors',
'--ignore-certificate-errors-spki-list '
]
参见:https://github.com/GoogleChrome/puppeteer/issues/1159一个>
这篇关于尝试在 Node.js/Puppeteer 中使用代理服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文