Extension Chrome.Proxy, Only Proxy To Some of Webs

2019-03-04 09:51发布

问题:

So Bypasslist in chrome.proxy will bypass the list from using proxy, but what i need is proxy only some of website i want like only 4 website and except that bypass by the proxy, if i need to make a list inside bypass list it will be hell.

Can i do that with chrome.proxy ? So Only Some Website Get Proxied.

回答1:

The documentation provides an example where you specify a PAC script:

var config = {
  mode: "pac_script",
  pacScript: {
    data: "function FindProxyForURL(url, host) {\n" +
          "  if (host == 'foobar.com')\n" +
          "    return 'PROXY blackhole:80';\n" +
          "  return 'DIRECT';\n" +
          "}"
  }
};
chrome.proxy.settings.set(
    {value: config, scope: 'regular'},
    function() {});

The example does exactly what you require for 1 domain, and it should be possible to extend to several domains.