我试图访问的网站有 ssl 证书错误
我正在使用这个版本的 puppeteer "puppeteer": "1.13.0"
.
当我尝试 await page.goto('http://bad_ssl_certificate_website')
我在 上有超时错误谷歌云只要。
TimeoutError: Navigation Timeout Exceeded:
但是,它工作得很好本地在 MAC 上。
我认为问题是我网站的 ssl-certificate-errors,因为如果我尝试使用“google.com”,它在两种环境中都可以正常工作。
我用过 https://www.sslshopper.com检查 ssl 证书,它提到了这一点。
The certificate is not trusted in all web browsers. You may need to install an Intermediate/chain certificate to link it to a trusted root certificate. Learn more about this error. You can fix this by following DigiCert's Certificate Installation Instructions for your server platform. Pay attention to the parts about Intermediate certificates.
当我使用旧版本的 puppeteer 师我遇到了问题 本地以及。
我看到了完全相同的错误
'TimeoutError: Navigation Timeout Exceeded:'
更新到最新版本的 puppeteer 已修复仅在本地运行 puppeteer,但尚未修复运行在 上的 puppeteer。谷歌云
这就是我设置 puppeteer 吃午饭的方式。
const browser = await puppeteer.launch({
headless: true,
ignoreHTTPSErrors: true,
args: [
"--proxy-server='direct://'",
'--proxy-bypass-list=*',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-first-run',
'--no-sandbox',
'--no-zygote',
'--single-process',
'--ignore-certificate-errors',
'--ignore-certificate-errors-spki-list',
'--enable-features=NetworkService'
]
});
我发现了一些相关的问题:
https://bugs.chromium.org/p/chromium/issues/detail?id=877075
最佳答案
--ignore-certificate-errors-spki-list
实际上接受公钥哈希的白名单忽略与证书相关的错误。所以它的用法是:--ignore-certificate-errors-spki-list=jc7r1tE54FOO=
Chromium doc
关于ssl-certificate - 忽略证书错误 + headless puppeteer + google cloud,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55207690/