puppeteer 1.11.0 ignore --proxy-server for localhost URLs
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: v1.11.0
- Platform / OS version: macOS High Sierra
- URLs (if applicable): None
- Node.js version: v8.6.0
What steps will reproduce the problem?
- start a proxy on localhost on 8081
- start browserless with
--proxy-server=localhost:8081
- use
goto
with an URL on localhost
The request will bypass the configured proxy although it worked up until v1.10.0
.
If you use an url on some domain (ex: google.com) then the proxy will be used.
const puppeteer = require('puppeteer');
const { setupServer } = require('./test/helper');
(async () => {
const proxy = await setupServer(8081);
const server = await setupServer(80);
const browser = await puppeteer.launch({
args: [
'--proxy-server=localhost:8081',
]
});
const page = await browser.newPage();
try {
const response = await page.goto('http://localhost/page.html');
console.log('res', response.status());
} catch (e) {
console.log('err', e.message);
}
await browser.close();
await proxy.stop();
await server.stop();
})();
The setupServer
was copied from puppeteer
tests, I only added this:
requests() {
return this._requests;
}
reset() {
this._requests = [];
// rest of code
}
_onRequest(request, response) {
this._requests.push(request.url);
// rest of code
}
For my own tests to verify that the request goes through the proxy I started which looks like:
describe('HTTP proxy', () => {
it('uses configured HTTP proxy', async () => {
const proxy = await setupServer(8081);
try {
await fetch({ url: server.EMPTY_PAGE, http_proxy: 'localhost:8081' });
expect(proxy.requests()).to.include(server.EMPTY_PAGE);
} finally {
await proxy.stop();
}
});
});
What is the expected result?
- The request to go trough the configured proxy
What happens instead?
- The proxy is ignored
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to use proxy in puppeteer and headless Chrome?
Repository: https://github.com/Cuadrix/puppeteer-page-proxy ... To skip proxy simply call request.continue() conditionally.
Read more >Puppeteer开发过程中遇到的问题及解决方案 - CSDN博客
--data-reduction-proxy-http-proxies ⊗ The semicolon-separated list of proxy server URIs to override the list of HTTP proxies returned by ...
Read more >Make headless Chrome and Puppeteer use a proxy server
Apify's open-source proxy-chain on NPM enables you to run headless Chrome and Puppeteer over a proxy server that requires authentication.
Read more >mozilla-central: changeset 571784 ...
+Puppeteer tests are located in [the `test` directory](https://github.com/puppeteer/puppeteer/blob/main/test/) and are written using Mocha. See [`test/README.md ...
Read more >Http-proxy NPM - npm.io
createProxyServer ({target:'http://localhost:9000'}).listen(8000); // See (†) // // Create your target server // http.createServer(function (req, res) { res.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@panthony If you’re on Chrome 72, you may be hitting the problem discussed in this Cypress bug report.
Apparently
--proxy-bypass-list=<-loopback>
will fix the issue.@panthony @sethfowler awesome, thanks for the investigation!
I’ve added this option to the
//examples/proxy.js
- should be good enough for now.