Using --proxy-pac-url in headless mode doesn't work.
Reported by
jayhocke...@gmail.com,
Sep 14 2017
|
||||
Issue descriptionChrome Version : 61.0.3163.79 URLs (if applicable) : N/A Other browsers tested: N/A What steps will reproduce the problem? (1) Create PAC file to block requests (all JavaScript files for example). (2) Use ChromeDriver to run Chrome with the following options: --headless --disable-gpu --proxy-pac-url=<PAC file> What is the expected result? Headless Chrome should honor the --proxy-pac-url file and block requests. What happens instead? When I use ChromeDriver with --proxy-pac-url and no --headless, the expected requests in the PAC file are being blocked. When I use ChromeDriver with --proxy-pac-url and --headless, the expected requests are not being blocked. It appears that, when in headless mode, the --proxy-pac-url option is being ignored.
,
Sep 21 2017
I can confirm the same behavior for me using chrome headless through puppeteer. My pac file: ``` https://bugs.chromium.org/p/chromium/issues/entry?components=Internals%3EHeadless&blocking=705916 ``` This is how chromium is invoked in headless mode: /home/louis/Code/test/v2/test_server/node_modules/puppeteer/.local-chromium/linux-499413/chrome-linux/chrome --disable-background-networking --disable-background-timer-throttling --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-translate --enable-automation --enable-devtools-experiments --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=0 --safebrowsing-disable-auto-update --use-mock-keychain --user-data-dir=/tmp/puppeteer_dev_profile-LFIwKr --headless --disable-gpu --hide-scrollbars --mute-audio --disable-gpu --disable-setuid-sandbox --force-device-scale-factor --ignore-certificate-errors --no-sandbox --proxy-pac-url=file:///home/louis/Code/test/v2/test_server/built/proxy_pac.js And in normal mode: /home/louis/Code/test/v2/test_server/node_modules/puppeteer/.local-chromium/linux-499413/chrome-linux/chrome --disable-background-networking --disable-background-timer-throttling --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-translate --enable-automation --enable-devtools-experiments --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=0 --safebrowsing-disable-auto-update --use-mock-keychain --user-data-dir=/tmp/puppeteer_dev_profile-9K3YUo --disable-gpu --disable-setuid-sandbox --force-device-scale-factor --ignore-certificate-errors --no-sandbox --proxy-pac-url=file:///home/louis/Code/test/v2/test_server/built/proxy_pac.js Chromium revision: 499413 puppeteer: aa58f25bc1c7f8cf72c70c453f036bb873349164 Debian stretch
,
Sep 21 2017
Looks like I failed to paste the pac file. Here it is:
"use strict";
function FindProxyForURL(_url, _host) {
return `PROXY 127.0.0.1:10000;`;
}
,
Sep 21 2017
The PAC file that I was playing around with:
function FindProxyForURL(url, host) {
var url = url.toLowerCase();
var host = host.toLowerCase();
if (shExpMatch(url, "*.css")) { return "PROXY localhost:3421" }
if (shExpMatch(url, "*.js")) { return "PROXY localhost:3421" }
return "DIRECT";
}
I tried this on OS X version 10.11.5 and Debian Jessie.
,
Sep 21 2017
Thank you for providing more feedback. Adding requester "pnangunoori@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 2 2017
,
Oct 3 2017
Headless does not implement all the possible proxy configurations, so this is a feature request rather than a bug. We'll put it on our roadmap based on how many people want it, so star it if it's important to you.
,
Oct 3 2017
Thanks for looking into it. It makes sense that this would be a feature request. I think this would a worthwhile feature to support in headless, since blocking certain requests that aren't needed would improve performance in multiple ways: reduce CPU usage, memory usage, and improve page load times.
,
Oct 10 2017
Also, this is the only programmatic way to choose different proxies for different pages/resources without restarting chrome, which is a heavy action.
,
Oct 16 2017
It would be really handy to have this feature. Then the support for the
most important proxy features is complete.
--proxy-server (61.0)
--proxy-bypass-list (62.0)
--proxy-pac-url (and hopefully 62.0)
I found myself in the middle of a testing suite with a proxy setup for
stubbing requests/responses. Unfortunately, I have to deal with WebSockets,
which I need to bypass. This is not possible with the bypass-list option,
and the following PAC config is not working on headless. (fine on non-headless)
function FindProxyForURL(url, host)
{
if (url.substring(0, 3) == "ws:" ||
url.substring(0, 4) == "wss:") {
return "DIRECT";
}
return "PROXY localhost:39159";
}
It could be really useful also in other situations. Please add this to the roadmap. :)
,
May 18 2018
i have use 65, and when i use the headless than the chrome do not requrest the pac file.
,
Aug 13
Up! I'd really appreciate if someone will work on this issue. It's really needed! Thank you in advance.
,
Nov 7
Up! I need this feature too.
,
Nov 12
I've implemented simple patch for kProxyPacUrl support according ChromeCommandLinePrefStore::ApplyProxyMode(). As manually tested, it works well for headless_shell and Chrome.app (with --headless in MacOS).
,
Dec 4
I tried your patch on a chromium fetch at 29/11/2018. Compile/Run on Linux Fedora 29 : It doesn't work despite the config object is now well set, because headless mode seems to use a different proxy resolver than headfull : From net/proxy_resolution/proxy_resolution_service.cc / ProxyResolutionService::CreateUsingSystemProxyResolver : "PAC support disabled because there is no system implementation" Note : I had a false hope when first trying, because "mandatory" was set to false in your patch, and chromium had fallback gracefuly by not using the PAC URL. |
||||
►
Sign in to add a comment |
||||
Comment 1 by pnangunoori@chromium.org
, Sep 18 2017Labels: Needs-Triage-M61 Needs-Feedback