|
| 1 | +--- |
| 2 | +id: bypass-proxy-domains |
| 3 | +title: How to Bypass Proxy Domains |
| 4 | +hide_title: false |
| 5 | +sidebar_label: Bypass Proxy Domains |
| 6 | +description: Learn how to use LambdaTest bypassProxyDomains capability to specify domains that should bypass the dedicated proxy. |
| 7 | +keywords: |
| 8 | +- custom headers lambdatest |
| 9 | +- bypass firewalls restrictions |
| 10 | +- custom headers bypass firewalls |
| 11 | +url: https://www.lambdatest.com/support/docs/bypass-proxy-domains/ |
| 12 | +site_name: LambdaTest |
| 13 | +slug: bypass-proxy-domains/ |
| 14 | +--- |
| 15 | + |
| 16 | +<script type="application/ld+json" |
| 17 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 18 | + "@context": "https://schema.org", |
| 19 | + "@type": "BreadcrumbList", |
| 20 | + "itemListElement": [ |
| 21 | + { |
| 22 | + "@type": "ListItem", |
| 23 | + "position": 1, |
| 24 | + "name": "Home", |
| 25 | + "item": "https://www.lambdatest.com" |
| 26 | + }, |
| 27 | + { |
| 28 | + "@type": "ListItem", |
| 29 | + "position": 2, |
| 30 | + "name": "Support", |
| 31 | + "item": "https://www.lambdatest.com/support/docs/" |
| 32 | + }, |
| 33 | + { |
| 34 | + "@type": "ListItem", |
| 35 | + "position": 3, |
| 36 | + "name": "Bypass Proxy Domains", |
| 37 | + "item": "https://www.lambdatest.com/support/docs/bypass-proxy-domains/" |
| 38 | + } |
| 39 | + ]}) |
| 40 | + }}> |
| 41 | +</script> |
| 42 | + |
| 43 | +When running tests with Dedicated Proxy (DP) enabled, all outgoing requests are routed through the proxy. While this provides secure and controlled network access, it can sometimes cause issues when your tests need to access services running locally, such as localhost endpoints or specific internal domains. |
| 44 | + |
| 45 | +To solve this, you can use the `bypassProxyDomains` capability. This capability lets you define a list of domains that should bypass the dedicated proxy and instead be resolved directly from the test environment. |
| 46 | + |
| 47 | +With `bypassProxyDomains`, you can configure specific domains (like localhost) to skip the proxy hop and resolve locally. This ensures that local APIs, servers, or background services started during tests remain accessible. |
| 48 | + |
| 49 | +## Capability Reference |
| 50 | + |
| 51 | +| Capability | Type | Required | Description | |
| 52 | +| -------------------- | --------- | -------- | ------------------------------------------------------------------------------ | |
| 53 | +| `dedicatedProxy` | `boolean` | Yes | Must be set to `true` for `bypassProxyDomains` to take effect. | |
| 54 | +| `bypassProxyDomains` | `array` | Optional | List of domains (hostnames) to bypass the dedicated proxy and resolve locally. | |
| 55 | + |
| 56 | +> `dedicatedProxy: true` is mandatory for bypassProxyDomains to take effect. |
| 57 | +
|
| 58 | +## Example Usage |
| 59 | + |
| 60 | +```java title="test1.java" |
| 61 | +DesiredCapabilities capabilities = new DesiredCapabilities(); |
| 62 | +String bypassProxyDomains[] = { "127.0.0.1", "localhost", "todomvc" }; |
| 63 | + |
| 64 | +capabilities.setCapability("dedicatedProxy", true); |
| 65 | +capabilities.setCapability("bypassProxyDomains", bypassProxyDomains); |
| 66 | +``` |
0 commit comments