# ProxyConfig

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/ProxyConfig.java+class:androidx.webkit.ProxyConfig) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

*** ** * ** ***


```
public final class ProxyConfig
```

<br />

*** ** * ** ***

Config for `https://developer.android.com/reference/androidx/webkit/ProxyController#setProxyOverride(androidx.webkit.ProxyConfig,java.util.concurrent.Executor,java.lang.Runnable)`.

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 https://developer.android.com/reference/androidx/webkit/ProxyConfig.Builder` ProxyConfig builder. |
| `public final class https://developer.android.com/reference/androidx/webkit/ProxyConfig.ProxyRule` Class that holds a scheme filter and a proxy URL. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/ProxyConfig#MATCH_ALL_SCHEMES() = "*"` Matches all schemes. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/ProxyConfig#MATCH_HTTP() = "http"` HTTP scheme. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/ProxyConfig#MATCH_HTTPS() = "https"` HTTPS scheme. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/webkit/ProxyConfig#getBypassRules()()` Returns the current list that holds the bypass rules represented by this object. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/webkit/ProxyConfig.ProxyRule>` | `https://developer.android.com/reference/androidx/webkit/ProxyConfig#getProxyRules()()` Returns the current list of proxy rules. |
| `boolean` | `https://developer.android.com/reference/androidx/webkit/ProxyConfig#isReverseBypassEnabled()()` Returns `true` if reverse bypass is enabled. |

## Constants

### MATCH_ALL_SCHEMES

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
public static final String MATCH_ALL_SCHEMES = "*"
```

Matches all schemes.

### MATCH_HTTP

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
public static final String MATCH_HTTP = "http"
```

HTTP scheme.

### MATCH_HTTPS

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
public static final String MATCH_HTTPS = "https"
```

HTTPS scheme.

## Public methods

### getBypassRules

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
public @NonNull List<String> getBypassRules()
```

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

To add new rules use `https://developer.android.com/reference/androidx/webkit/ProxyConfig.Builder#addBypassRule(java.lang.String)`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | List of bypass rules |

### getProxyRules

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
public @NonNull List<ProxyConfig.ProxyRule> getProxyRules()
```

Returns the current list of proxy rules. Each `https://developer.android.com/reference/androidx/webkit/ProxyConfig.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 `https://developer.android.com/reference/androidx/webkit/ProxyConfig.Builder#addProxyRule(java.lang.String)` or `https://developer.android.com/reference/androidx/webkit/ProxyConfig.Builder#addProxyRule(java.lang.String,java.lang.String)`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/webkit/ProxyConfig.ProxyRule>` | List of proxy rules |

### isReverseBypassEnabled

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/webkit#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. `https://developer.android.com/reference/androidx/webkit/ProxyConfig#getBypassRules()` returns the URL list.

See `https://developer.android.com/reference/androidx/webkit/ProxyConfig.Builder#setReverseBypassEnabled(boolean)` for a more detailed description.

| Returns |
|---|---|
| `boolean` | reverseBypass |