puppeteer: ignoreHTTPSErrors is not working when request interception is on
Steps to reproduce
Tell us about your environment:
- Puppeteer version: ab9b34cd5dad54e170be916016a4e9b4097231ed
- Platform / OS version: debian stretch, nodejs 8.8
- URLs (if applicable): https://halva.khady.info
What steps will reproduce the problem?
Just launch this code to see the problem:
// https.js
'use strict';
const puppeteer = require('puppeteer');
const URL = "https://halva.khady.info/";
(async() => {
const args = [
"--disable-setuid-sandbox",
"--no-sandbox",
];
const options = {
args,
headless: true,
ignoreHTTPSErrors: true,
};
const browser = await puppeteer.launch(options);
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on("request", (request) => {
if (request.resourceType === "Image") {
request.abort();
} else {
request.continue();
}
});
await page.goto(URL, { timeout: 8000, waitUntil: "load" });
const html = await page.content();
console.log(html);
await page.close();
await browser.close();
})();
What is the expected result?
With the request interception disabled:
// await page.setRequestInterception(true);
// page.on("request", (request) => {
// if (request.resourceType === "Image") {
// request.abort();
// } else {
// request.continue();
// }
// });
$ nodejs misc/https_headless.js
<html><head><title>potkw</title></head>
<body>
Khady Khady roule roule
</body></html>
What happens instead?
$ nodejs misc/https_headless.js
(node:23556) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Navigation Timeout Exceeded: 8000ms exceeded
(node:23556) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^C
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 33
- Comments: 37 (5 by maintainers)
Commits related to this issue
- add explicit ignore certificate errors argument for puppeteer This however does not resolve a current issue where chrome headless hangs in self signed ceritificate errors, even with these flags. It o... — committed to pocketjoso/penthouse by pocketjoso 6 years ago
- feat(chromium): roll Chromium to r588429 This roll includes: - https://crrev.com/588420 - DevTools: teach request interception to work with Security.setIgnoreCertificateErrors Fixes #1159. — committed to aslushnikov/puppeteer by aslushnikov 6 years ago
- feat(chromium): roll Chromium to r588429 (#3181) This roll includes: - https://crrev.com/588420 - DevTools: teach request interception to work with Security.setIgnoreCertificateErrors Fixes #1... — committed to puppeteer/puppeteer by aslushnikov 6 years ago
I ran into the same problem, worked around it by doing the following:
However, even with this work-around, I still think that the fix for this issue is super high priority. Thanks!
Is there any progress?
What the shit, after so many bloody years, still the same issue.
This is a major problemo. Hope it gets fixed soon.
@maZahaca: pptr 1.8.0 will be released on September, 6.
This bug will be fixed once Chromium completes migration onto Network Service.
As a workaround, network service could be enabled via a runtime flag
--enable-feature=NetworkService
.Beware! NetworkService is not completed yet and doesn’t pass all pptr tests.
Still, the following works for me:
Is there any progress?
When I use this args: --enable-feature=NetworkService then --proxy-server=xxx is not working!
seems like I use ‘–no-sandbox’,and proxy is not working, https://groups.google.com/a/chromium.org/forum/#!topic/network-service-dev/qr7yCQeoT4o
as @bluepeter mentioned its still an issue. Its not working on google cloud which is Linux based Any workarounds?
#1441 same as yours
use this
I am having same problem with https site, while running puppeteer in docker
Wow Wow Wow. The original issue from Chromium was just fixed! Yay!
Let’s get this stuff moving…
Why is it closed? Isn’t it gonna be resolved?
This work only when you launch puppeteer with
headless: false
. See https://github.com/GoogleChrome/puppeteer/issues/1159#issuecomment-343421349BTW, the
--ignore-certificate-errors-spki-list
flag is not doing anything if you don’t use the--user-data-dir
flag according to this documentation.Just tried
--enable-feature=NetworkService
with Puppeteer 1.6.2 and accompanying Chromium, but it’s still not working.I tested using the URL
http://finishline.com
which hangs when using withawait page.setRequestInterception(true);
and there was no difference using--enable-feature=NetworkService
as without it. Puppeteer just hangs up until goto timeout ends,browser launch:
browser = await puppeteer.launch({ args: ['--enable-features=NetworkService'], headless: true, timeout: 30000, ignoreHTTPSErrors: true });
goto:
await page.goto(url, { timeout: 60000, waitUntil: 'load' })
If you can use puppeteer without chrome headless, a solution seems to be the
--ignore-certificate-errors
flags. Unfortunately it doesn’t work with chrome headless.Seems to still be an issue
setRequestInterception(true)
in docker as well when using the following setup:@aslushnikov
puppeteer-firefox
has this issue still. Is there a separate thread for it?Note: this is still an issue for those of us trying to run on Linux. See: https://bugs.chromium.org/p/chromium/issues/detail?id=877075
Great job!