11

I have an shortcut on several Windows PCs that points to Chrome with --proxy-pac-url.

Full Target: field in shortcut properties looks like this:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-pac-url=file://C:/Local/Drive/Path/To/proxy.pac

One PC is always on and didn't restart Chrome in a long time. It still runs Chrome 71. On this PC .pac still works and I can access dynamically proxified resources. On the rest, where Chrome was updated to 72 and restarted it no longer works - Chrome tries to access resource directly and fails. Additionally, I can't debug it, since chrome://net-internals/#proxy shows is empty of any info save for re-apply/clear buttons.

So, what broke, how can I debug this and how to make a specific instance of Chrome run with specific .pac once again? Without always swapping options by hand, of course.

5 Answers 5

3

Chrome 72-75:

  • As suggested in this bug report, you can disable 'Enable Network Service' in chrome://flags to go back to the old behaviour that supports file:// pac files. Starting Chrome from the command-line with --disable-features=NetworkService has the same effect.

Chrome 76:

  • It seems that the 'Network Service' option has been removed from chrome://flags (see the code commit).

    You can still run Chrome with --disable-features=NetworkService (ref) (e.g. /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-features=NetworkService on a Mac), and it seems to read the PAC file ok, though there might be some issues (because lots of related code seems to have been deleted already - see this issue - I guess YMMV, and this won't be a long-term solution.

    As suggested in the bug report, you are probably better either installing a browser plugin that lets you define PAC settings, or use an http(s) PAC file.

1
  • 2
    Note that even --disable-features=NetworkService is only a temporary fix; from the linked bug, "we will not be supporting file:// URLs when the Network Service is enabled, and will be deprecating support completely in the future." Oct 1, 2019 at 23:21
7

Chrome removed almost all functionality of net-internals for some reason and it sounds like they removed the pac flag that you were using.

chromium docs link to this site that still lists the flag as valid.

https://peter.sh/experiments/chromium-command-line-switches/

3
  • 6
    Here's the related Chromium issue where file:// PAC files were removed: bugs.chromium.org/p/chromium/issues/…
    – paulcm
    Feb 18, 2019 at 12:45
  • 6
    Also, as suggested in the bug, you can also disable 'Enable Network Service' in chrome://flags to go back to the old behaviour that supports file:// pac files, though that will also be removed in future. Starting Chrome like /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-features=NetworkService has the same effect.
    – paulcm
    Feb 18, 2019 at 14:05
  • 2
    @paulcm that should be an answer. Feb 18, 2019 at 15:32
5

I know this is an old thread but it still ranks high in Google search results.

I'm still successfully using a local .pac file with Chrome and Chromium 97 in Linux. I'm running Chrome with the following:

--proxy-pac-url='data:application/x-javascript-config;base64,'$(base64 -w0 /path/to/local/proxy.pac)

This basically encodes the .pac file as base64 string and loads it as if it where some web response.

If you want to use this on Windows, see @TBGs answer

4
  • 1
    Thanks, this worked for me on Chromium 87.0
    – lsl
    Nov 24, 2020 at 6:46
  • 1
    This answer deserves more upvotes!
    – pst
    Jul 20, 2021 at 6:19
  • it din't work but thanks to this answer I could realize that a just need to move the .pac file to my lighttpd folder and point to there.
    – rodvlopes
    Jun 2 at 19:07
  • This still works in Chrome 102! Thanks! Jun 7 at 21:53
1

Unfortunately, Chrome plans to remove --disable-features=NetworkService and support for file:/// PAC URLs entirely in the future.

Here's the upstream bug (and specifically the comment marking WONTFIX): https://bugs.chromium.org/p/chromium/issues/detail?id=839566#c40

The solution that should work on Chrome 76+, without requiring an httpd, is to take the .zip file attached to that comment, unpack it somewhere permanent, and modify the bundled my_pac_script.js to be a symlink to your previous file:///... PAC file. Then install the extension in Chrome. It will load the PAC configuration when Chrome is started.

0

@jonny 's answer works like a charm ! (encoding proxy pac content to Base64)

However, if you're on Windows and have the same need, here's a small Powershell script you can use :

$proxyPacURL = "http://YOUR_URL/proxy.pac";
$proxyPacBytes = (Invoke-webrequest -URI $proxyPacURL).Content;
$proxyPacBase64 = [Convert]::ToBase64String($proxyPacBytes);
& 'C:\Program Files\Google\Chrome\Application\chrome.exe' --proxy-pac-url='data:application/x-javascript-config;base64,'$proxyPacBase64;
stop-process -Id $PID;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.