gajus / puppeteer-proxy

Proxies Puppeteer Page requests.
Other
197 stars 24 forks source link

Https proxy failed #4

Closed mingcaizhang closed 4 years ago

mingcaizhang commented 4 years ago

I used the following code to do a proxy test. The proxy works for the http, but not for the https.

async login_test() { const browser = await Puppeteer.launch({ headless: false, devtools: false, ignoreHTTPSErrors: true, defaultViewport: { width: 1920, height: 1080 }, args: [ '--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-first-run', '--no-zygote', '--no-sandbox', '--disable-infobars', ], }); const page = await browser.newPage(); await page.setRequestInterception(true); logger.info("login_test") page.on('request', async (request) => { await Puppeteer_proxy.proxyRequest({ page, proxyUrl: 'http://127.0.0.1:8001', request, }); });

await page.goto('http://gajus.com');
// await page.goto('https://baidu.com');

}

The error for the https is the following: [2020-03-05T20:45:10.172] [ERROR] system - Error: net::ERR_FAILED at https://baidu.com at navigate (C:\jeffrey\project\huya-client_local\huya-client_local\huya\node_modules\puppeteer\lib\FrameManager.js:120:37) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async FrameManager.navigateFrame (C:\jeffrey\project\huya-client_local\huya-client_local\huya\node_modules\puppeteer\lib\FrameManager.js:94:17) at async Frame.goto (C:\jeffrey\project\huya-client_local\huya-client_local\huya\node_modules\puppeteer\lib\FrameManager.js:406:12) at async Page.goto (C:\jeffrey\project\huya-client_local\huya-client_local\huya\node_modules\puppeteer\lib\Page.js:675:12) at async Login.login_test (C:\jeffrey\project\huya-client_local\huya-client_local\huya\src\module\login.js:105:5) -- ASYNC -- at Frame. (C:\jeffrey\project\huya-client_local\huya-client_local\huya\node_modules\puppeteer\lib\helper.js:111:15) at Page.goto (C:\jeffrey\project\huya-client_local\huya-client_local\huya\node_modules\puppeteer\lib\Page.js:675:49) at Page. (C:\jeffrey\project\huya-client_local\huya-client_local\huya\node_modules\puppeteer\lib\helper.js:112:23) at Login.login_test (C:\jeffrey\project\huya-client_local\huya-client_local\huya\src\module\login.js:105:16) at processTicksAndRejections (internal/process/task_queues.js:97:5)

Any idea for this?

Thanks!

mingcaizhang commented 4 years ago

It works after upgrading the puppeteer to 2.1.1. It's not a puppeteer-proxy bug.