Testing behind a proxy

Guide for running your Cypress tests when your application is behind a proxy.

If you have correctly set up Local Testing but are still unable to load your local/internally-hosted website/assets on BrowserStack, then you are probably behind a proxy.

You can use Local Testing to test websites hosted behind proxies, on our remote browsers and devices. The setup will vary based on the proxy implementation in your network. Refer to this article to find proxy settings on your computer or contact your network/IT team.

Currently, we only support Local Testing through the following proxies:

  1. Proxy with no authentication or HTTP Basic Authentication.
  2. MITM proxy with no authentication or HTTP Basic Authentication.
  3. PAC (Proxy Auto-Configuration) with no authentication.
Note: For Local Testing to work correctly, bypass traffic for bs-local.com in your proxy server if required.

If you’re behind a proxy

If the machine you want to run your tests is behind a proxy, you can use the proxy options as follows:

Command Line
BrowserStackLocal --key YOUR_ACCESS_KEY --proxy-host <proxy_host> --proxy-port <proxy_port>

If your proxy requires authentication, add --proxy-user and --proxy-pass to the above command.

To resolve all requests on our remote browsers and mobile devices through your proxy, add --force-proxy and --force-local flags to the command. Without these flags, Local binary tries to connect directly for better performance.

Once the connection is established, you can use local key in the connection_settings option to specify the Local connection settings. For example:

browserstack.json
{
  "connection_settings": {
    "local": true
  }
}

MITM Proxy

If your proxy type is MITM (like BrowserMob), you will need the Proxy Host and Proxy Port. Once you have the Host and Port, you can establish a Local Testing connection like this:

Command Line
BrowserStackLocal --key YOUR_ACCESS_KEY --local-proxy-host <proxy_host> --local-proxy-port <proxy_port>

To resolve all requests on our remote browsers and mobile devices through your proxy, add --force-proxy and --force-local flags to the command. Without these flags, Local binary tries to connect directly for better performance.

Once the connection is established, you can use local key in the connection_settings option to specify the Local connection settings. For example:

browserstack.json
{
  "connection_settings": {
    "local": true
  }
}

PAC (Proxy Auto-Configuration)

PAC file (Proxy auto-configuration file) contains a Javascript function that determines whether a request should be sent via the proxy server.

Once you have the absolute path of the PAC file on your machine, you can establish a Local Testing connection like this:

Command Line
BrowserStackLocal --key YOUR_ACCESS_KEY --pac-file <pac_file_abs_path>

To resolve all requests on our remote browsers and mobile devices through your proxy, add --force-proxy and --force-local flags to the command. Without these flags, Local binary tries to connect directly for better performance.

Once the connection is established, you can use local key in the connection_settings option to specify the Local connection settings. For example:

browserstack.json
{
  "connection_settings": {
    "local": true
  }
}

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert