How to Bypass Proxy Domains
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.
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.
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.
Capability Reference
Capability | Type | Required | Description |
---|---|---|---|
dedicatedProxy | boolean | Yes | Must be set to true for bypassProxyDomains to take effect. |
bypassProxyDomains | array | Optional | List of domains (hostnames) to bypass the dedicated proxy and resolve locally. |
dedicatedProxy: true
is mandatory for bypassProxyDomains to take effect.
Example Usage
DesiredCapabilities capabilities = new DesiredCapabilities();
String bypassProxyDomains[] = { "127.0.0.1", "localhost", "todomvc" };
capabilities.setCapability("dedicatedProxy", true);
capabilities.setCapability("bypassProxyDomains", bypassProxyDomains);