I was recently hired in a large corporation where I need a VPN to access email and other vital resources. When connected to the VPN, I need a wide range of HTTP proxies to access various URLs. On Windows PCs, this is configured automatically using a PAC file, so everything works as expected. On Linux...

I can use this PAC file to make my browser behave correctly:

chromium --proxy-pac-url="http://proxy.corporation.com/proxy.pac"

But the rest of my system is SOL and can't access anything unless I manually specify a HTTP proxy like:

http_proxy="http://foo.corporation.com" https_proxy="http://foo.corporation.com" slack

Needless to say this is extremely impractical and I need to restart all my applications when I connect or disconnect from the VPN.

The only "clean" and somewhat practical solution I can imagine is to run a local proxy server and permanently set all proxy environment variables to use it. I can then configure that proxy server based on what network I'm connected to, without having to restart any of my applications.

The proxy server would need to support PAC files, or at least be configurable enough for me to manually configure the rules specified in the PAC file myself (or via a script).

Do any such proxy servers exist?

  • slack is Chromium in a thin disguise. You should first check that it does not support the --proxy-pac-url command-line option. – JdeBP Apr 17 '19 at 11:56
  • @JdeBP slack was just one example out of many. Also, even if it does support --proxy-pac-url I would still have to restart Slack after disconnecting from the VPN. – Hubro Apr 17 '19 at 12:30
  • Yet that is correct behaviour for your browser, you tell us. – JdeBP Apr 17 '19 at 23:05
  • @JdeBP I don't understand. My browser (and possibly Slack, as you say) support proxy auto configuration via --proxy-pac-url, but the vast majority of my other applications don't. In any case, even if all my applications supported PAC, I would still have to restart them when I connect to the VPN, so it's not a great solution. The only convenient solution I can picture is to configure all my applications to always use a local proxy, then configure that proxy based on which network I'm connected to. I just have to find a proxy server that supports using PAC, not just generating it... – Hubro Apr 18 '19 at 14:35

Yes, there are projects such as pacproxy. A widely used proxy, Shadowsocks, internally uses PAC too.

| improve this answer | |
  • 1
    pacproxy looks perfect! Thanks – Hubro Aug 11 '19 at 14:50

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.