Search code examples
androidfirefoxproxyfirefox-addonandroid-4.4-kitkat

How to configure a proxy exclusion list on Android non-programmatically?


I'm running Android Kit-Kat 4.4.2. I've been able to configure a global proxy using the settings.db database in data/data/com.android.providers.settings/databases, which I've been manually altering using adb. To do this I've done the following:

  • Inserted a value into the global table with _id=99, name='http_proxy', and value='[proxy_host]:[proxy_port]' (obviously replacing [proxy_host] and [proxy_port] with their appropriate values).
  • Rebooted. This automatically generates rows in the global table with names: global_http_proxy_host, global_http_proxy_port, global_proxy_pac_url, and global_http_proxy_exclusion_list.
  • The global_http_proxy_host and global_http_proxy_port rows have been automatically given the correct settings (i.e. [proxy_host] and [proxy_port], respectively). The rest are empty.

The proxy works. For reference, I'm using Firefox for Android version 44.0.1 to test that it works. As long as the network.proxy.type setting has a value of 5 then this global proxy is respected (see this Mozilla knowledge-base).

When I enter a URL into the global_http_proxy_exclusion_list and test to see if it's been excluded, I'm still routed through the proxy. I thought that maybe I needed to reboot the device for the update to take, but on reboot the global_http_proxy_exclusion_list resets so that it is empty once more.

I've tried doing a web search for this property but I just get links to source code, which is not helpful in this instance.

I've also found this StackOverflow question which configures a proxy exclusion list programmatically. If this is the only way to configure such a list then it will make do, but I'd rather avoid it if I can.

I've been able to specifically configure Firefox with a proxy exclusion list using the network.proxy.no_proxies_on configuration option (and setting network.proxy.type to 1), but would like to know if there's a way to set a global proxy.

Use of an Android app would be an acceptable solution to this problem. I've installed ProxyDroid and configured a proxy but, as far as I can tell, this does nothing (or Firefox just doesn't respect the proxy). (For anybody who might believe that using ProxyDroid is the right answer here: I have rooted my device but still get messages from ProxyDroid saying that a rooted device is required. Is this normal?)

Is there any way for me to configure a proxy exclusion list in Android non-programmatically?


Solution

  • In order for your global_http_proxy_exclusion value to persist, I think you need to remove the old http_proxy entry. (In other words, only set the global_http_proxy_* keys.)

    ConnectivityService implements a handleDeprecatedGlobalHttpProxy() method that looks at the old http_proxy key before generating a new ProxyInfo that gets persisted to the global_http_proxy_* keys. The ProxyInfo this method generates always uses a blank exclusion list, which I think is what's overwriting the value you set once Android boots up.

    Running Lollipop, my exclusion list persisted after reboot when I removed http_proxy and just relied on the global settings.