Click here to Skip to main content
14,977,910 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
With Firefox, I use a proxy.pac file for ad-blocking. Since ad-blocking is an evil purpose, Google removed the support for proxy.pac files from Chrome. I'd like to be Bad Bernie and use my file with Chrome, too.
Do you have any evil ideas how to trick Chrome?
(Without too much effort like setting up a real proxy server, because I am lazy too. After all, Firefox still worx.)

What I have tried:

A solution is known for Linux. Call chrome with the parameter
--proxy-pac-url='data:application/x-javascript-config;base64,'$(base64 -w0 /path/to/local/proxy.pac)
(see https://superuser.com/a/1596133/554401 )

The base64 part makes sure that the contents are packed in a single line. That can be achieved on Windows with
certutil -f -encodehex myfile.txt myfile.enc 0x40000001
Next, he content can be transferred into an environment variable with
SET /p MYARGS= < myfile.enc
And eventually the command line becomes
chrome.exe proxy-pac-url='data:application/x-javascript-config;base64,'%MYARGS%
Unfortunately, my proxy.pac file has some 100kB, and that's toooo big for an environment variable.

Are there any possibilities of e.g. referencing another local file from the proxy.pac file? Or different ways of supplying its contents to the command line?
Posted
Comments
Richard MacCutchan 9-Mar-21 9:09am
   
If everyone used adblockers the internet would very soon become too expensive to use.
Richard Deeming 10-Mar-21 11:22am
   
And if all ad networks were trustworthy, and there was no such thing as "malvertizing", then fewer people would feel the need to use an ad-blocker. :)
Richard Deeming 10-Mar-21 11:27am
   
It looks like Chrome still supports PAC files; just not those hosted on your local file system.

Could you run a local web server and host your PAC file there?

Also, are you sure about the MIME type? MDN says it should be application/x-ns-proxy-autoconfig:
Proxy Auto-Configuration (PAC) file - HTTP | MDN[^]
Bernhard Hiller 10-Mar-21 12:32pm
   
Thanks for your hints. A local web server is exactly beyond the "small and simple" scope of this question - do not add any unnecessary load to the old notebook. In a future scenario with upgraded hardware, things may look different - I try to avoid all the hassle with getting all the things correctly running on a different machine...
As for the MIME type, I found it on the stackoverflow answer; anyway, my blocklist is too large to fit the size parameters, so it won't make a difference.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900