3

I am working on an extension where proxy is set through my extension using chrome extension proxy api(chrome.proxy.settings). Everything works fine and I get all traffic on my proxy server except the ones in bypass list of course.

Now my question is: How do we bypass the proxy set dynamically? I mean Is there a way to bypass proxy for some URLs (not in proxy bypass list) programmatically? I understand bypass list included urls/patterns are bypassed. But I require some urls to bypass proxy on the go.

Anyone faced a similar requirement? Any direct method to bypass the same dynamically or any work around would be appreciated.

ankit.vic
  • 101
  • 3
  • 10
  • You might want to check [Debugging problems with the network proxy](https://www.chromium.org/developers/design-documents/network-stack/debugging-net-proxy) and see if it will help. It mentions about a given option to override the system proxy settings if you don't want to use it. In addition to that, more information can also be found in [Proxy settings and fallback](http://dev.chromium.org/developers/design-documents/network-stack/proxy-settings-fallback). – Teyam Dec 27 '16 at 12:27
  • Thanks @Teyam. Let me look into these. – ankit.vic Dec 27 '16 at 20:11
  • I went through the links but they does not seems to be helpful for me. – ankit.vic Jan 19 '17 at 10:28

1 Answers1

0

Bypass proxy on the go? You can pull any specify adressess from your web server. What's a problem?

For example:

chrome.windows.onCreated.addListener(function() {
  var config = {
      mode: 'fixed_servers',
      rules: {
        proxyForHttp: {
          scheme: 'http',
          host: '127.0.0.1',
          port: '80'
        },
        bypassList: []
      }
    },
    proxyByUrl = 'path/to/proxiesByUrl?path=' + window.location.href;

  $.get(proxyByUrl, function(data) {
    // Set up current proxy, dependent on request URL
    config.rules.proxyForHttp.host = data.proxyAddress;
    config.rules.proxyForHttp.port = data.proxyport;
    // Excluded URL's for this proxy
    bypassList.push(data.bypassUrls);
  });
});

Match all hostnames that match the pattern . A leading "." is interpreted as a "*.". Examples: "foobar.com", "foobar.com", ".foobar.com", "foobar.com:99", "https://x..y.com:99".

For more detailed patterns of bypassList, read the official documentation.

Lin Du
  • 88,126
  • 95
  • 281
  • 483
Correcter
  • 3,466
  • 1
  • 16
  • 14