# 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)

*** ** * ** ***


```
class ProxyConfig
```

<br />

*** ** * ** ***

Config for `https://developer.android.com/reference/kotlin/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.

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

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig.Builder` ProxyConfig builder. |
| `class https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig.ProxyRule` Class that holds a scheme filter and a proxy URL. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig#MATCH_ALL_SCHEMES() = "*"` Matches all schemes. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig#MATCH_HTTP() = "http"` HTTP scheme. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig#MATCH_HTTPS() = "https"` HTTPS scheme. |

| ### Public functions |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig#getBypassRules()()` Returns the current list that holds the bypass rules represented by this object. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig.ProxyRule!>` | `https://developer.android.com/reference/kotlin/androidx/webkit/ProxyConfig#getProxyRules()()` Returns the current list of proxy rules. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/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)

```
const val MATCH_ALL_SCHEMES = "*": String!
```

Matches all schemes.

### MATCH_HTTP

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

```
const val MATCH_HTTP = "http": String!
```

HTTP scheme.

### MATCH_HTTPS

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

```
const val MATCH_HTTPS = "https": String!
```

HTTPS scheme.

## Public functions

### getBypassRules

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

```
fun getBypassRules(): (Mutable)List<String!>
```

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

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

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | List of bypass rules |

### getProxyRules

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

```
fun getProxyRules(): (Mutable)List<ProxyConfig.ProxyRule!>
```

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

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/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)

```
fun isReverseBypassEnabled(): Boolean
```

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/kotlin/androidx/webkit/ProxyConfig#getBypassRules()` returns the URL list.

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | reverseBypass |