Local Testing with Network Restrictions
Learn how to use Local Testing when your network is behind a proxy, firewall, or VPN.
Test mobile apps that retrieve assets from hosts behind one (or more) proxies
If your mobile app retrieves assets from hosts located behind one or more proxies, you may need to configure the Local Testing connection based on your network restrictions.
If proxy is auto-detected
If your internet access is managed by a proxy server, you can configure the BrowserStack Local application to connect to BrowserStack servers through your proxy.
Follow these steps to configure the connection:
- Open a browser and go to the BrowserStack Local page at http://localhost:45454.
- Enter your access key.
- Click Connect.
If your network configuration does not require a proxy or if the proxy is auto-detected, BrowserStack Local starts automatically.
If proxy is not auto-detected
If a proxy is required and the app cannot auto-detect the settings, configure the proxy in the BrowserStack application dashboard. Follow the on-screen arrow to the Proxy Details section.
Depending on your network configuration, the proxy may require only a host and port, or it may also require a username and password.
If you are using an MITM proxy
BrowserStack classifies proxies as either transparent or MITM (man-in-the-middle) proxies, depending on whether they inspect the packets passing through them.
If your BrowserStack Local connection does not work after trying the previous configuration, you may be using a MITM proxy. In this case, enable the MITM Proxy option in the application settings.
If you are using a PAC file
If you have a PAC file (Proxy auto-configuration file) to configure your settings without any authentication information, you can enter the location of the file in the PAC File option in the app dashboard.
If you have correctly set up Local Testing but are still unable to load your app’s assets on remote mobile devices, then you are probably behind a proxy.
With Local Testing, you can test apps that retrieve data/content from servers that are behind proxies. 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 implementations: network proxy (with no authentication or Basic HTTP auth), MITM proxy (with no authentication or Basic HTTP auth) and PAC (Proxy Auto-Configuration) with no authentication.
For Local Testing to work correctly, bypass traffic for bs-local.com
in your proxy server. Once you have identified the proxy type and settings, follow the steps below to set up Local Testing.
Proxy
Proxies are commonly set up for office networks, remote servers, and/or your local machine. Contact your network/IT team to obtain the Proxy Host and Proxy Port to setup Local Testing for this implementation.
Once you obtain the Proxy Host and Port, follow the steps below to establish a Local Testing connection:
Download BrowserStack Local binary (Windows | macOS / OS X | Linux 32-bit | Linux 64-bit)
Unzip the file to a folder/directory on your machine. Open command-line interface and navigate to the folder containing the Local binary. You can now establish a Local Testing connection using --proxy-host
and --proxy-port
flags.
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 enhanced performance.
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, establish a Local Testing connection by running the following command through command-line interface:
Run the binary using the following command:
BrowserStackLocal --key YOUR_ACCESS_KEY \
--local-proxy-host <proxy_host> --local-proxy-port <proxy_port>
If your local proxy requires authentication, add --local-proxy-user
and --local-proxy-pass
to the above command.
To resolve all requests on our remote browsers and mobile devices through your local proxy, add --force-proxy
and --force-local
flags to the command. Without these flags, Local binary tries to connect directly for enhanced performance.
PAC (Proxy Auto-Configuration)
PAC file (Proxy Auto-Configuration file) is 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, establish a Local Testing connection using --pac-file
flag, along with the PAC file’s absolute path.
Run the binary using the following command:
BrowserStackLocal --key YOUR_ACCESS_KEY --pac-file <pac_file_abs_path>
To resolve all requests on our remote browsers and mobile devices through your local proxy, add --force-proxy
and --force-local
flags to the command. Without these flags, Local binary tries to connect directly for enhanced performance.
Sample PAC file
The following function checks to see whether the hostname is localhost, and if so, whether the connection is direct. If the hostname is not localhost, the connection is via proxy.
function FindProxyForURL(url, host) {
if (isPlainHostName(host))
return "DIRECT";
else
return "PROXY proxy:80";
}
If you do not understand the proxy script or are not authorized to make any changes to it, contact your IT/Network team.
Test mobile apps that retrieve assets from hosts behind a firewall or VPN
With Local Testing, you can test mobile apps serving content from internal servers that are behind a firewall and/or VPNs.
With Local Testing, you can test apps that retrieve data/content from servers behind firewalls and/or VPNs.
Start by making sure that your machine can access the website. Then, establish a Local Testing connection by following the steps listed in enabling Local Testing.
Additionally, you might need to whitelist Secure WebSocket (WSS) connections to
our platform (*.browserstack.com
) at port 443.
Next Steps
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
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!