ProxyConfig


public final class ProxyConfig


Config for setProxyOverride.

Proxy rules should be added using addProxyRule methods. Multiple rules can be used as fallback if a proxy fails to respond (for example, the proxy server is down). Bypass rules can be set for URLs that should not use these settings.

For instance, the following code means that WebView would first try to use proxy1.com for all URLs, if that fails, proxy2.com, and if that fails, it would make a direct connection.

ProxyConfig proxyConfig = new ProxyConfig.Builder().addProxyRule("proxy1.com")
                                                   .addProxyRule("proxy2.com")
                                                   .addDirect()
                                                   .build();

Summary

Nested types

public final class ProxyConfig.Builder

ProxyConfig builder.

public final class ProxyConfig.ProxyRule

Class that holds a scheme filter and a proxy URL.

Constants

static final String

Matches all schemes.

static final String
MATCH_HTTP = "http"

HTTP scheme.

static final String
MATCH_HTTPS = "https"

HTTPS scheme.

Public methods

@NonNull List<String>

Returns the current list that holds the bypass rules represented by this object.

@NonNull List<ProxyConfig.ProxyRule>

Returns the current list of proxy rules.

boolean

Returns true if reverse bypass is enabled.

Constants

MATCH_ALL_SCHEMES

Added in 1.1.0
public static final String MATCH_ALL_SCHEMES = "*"

Matches all schemes.

MATCH_HTTP

Added in 1.1.0
public static final String MATCH_HTTP = "http"

HTTP scheme.

MATCH_HTTPS

Added in 1.1.0
public static final String MATCH_HTTPS = "https"

HTTPS scheme.

Public methods

getBypassRules

Added in 1.1.0
public @NonNull List<StringgetBypassRules()

Returns the current list that holds the bypass rules represented by this object.

To add new rules use addBypassRule.

Returns
@NonNull List<String>

List of bypass rules

getProxyRules

Added in 1.1.0
public @NonNull List<ProxyConfig.ProxyRulegetProxyRules()

Returns the current list of proxy rules. Each ProxyRule object holds the proxy URL and the URL schemes for which this proxy is used (one of MATCH_HTTP, MATCH_HTTPS, MATCH_ALL_SCHEMES).

To add new rules use addProxyRule or addProxyRule.

Returns
@NonNull List<ProxyConfig.ProxyRule>

List of proxy rules

isReverseBypassEnabled

Added in 1.5.0
public boolean isReverseBypassEnabled()

Returns true if reverse bypass is enabled. Reverse bypass means that only URLs in the bypass list will use these proxy settings. getBypassRules returns the URL list.

See setReverseBypassEnabled for a more detailed description.

Returns
boolean

reverseBypass