Local Testing with Network Restrictions
Guide to using Local Testing when you’re behind proxy, firewall or a VPN.
Test websites behind one (or more) proxies
You might have one or more proxies in your network, and you might need to setup the Local testing connection accordingly depending on your restrictions. (Go through this link for downloading and enabling Browserstack local before setting it up)
If proxy is auto-detected
If your internet access is mediated by a proxy server, you can configure the BrowserStack Local application to connect to our servers via your proxy. Follow these steps to get this up and running:
Navigate to http://localhost:45454, and enter your key
In case the network configuration does not require a proxy or is auto-detected you should already be up and running.
If proxy is not auto-detected
If a proxy is a strict requirement and the app is unable to auto-detect settings, you can simply configure your proxy in our dashboard on the next screen. Follow the arrow as it points you to the proxy details section.
Depending on your network settings, the proxy can work with just a host and a port, or it might need a username and a password as well.
If you’re using an MITM proxy
We classify proxies into two types – transparent and MITM proxies (depending on whether or not they inspect the packets passing through them).
If your BrowserStack Local connection doesn’t work even after all this setup has been done correctly, you might be using a MITM proxy – which you can indicate to the application using a simple toggle.
If you’re using a PAC file
If you have a PAC file (Proxy auto-configuration file) 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 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. 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.
bs-local.com
in your
proxy server. Once you’ve 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 don’t understand the proxy script or are not authorized to make any changes to it, contact your IT/Network team.
Test websites behind a firewall or VPN
With Local Testing, you can test internally hosted websites that are behind a firewall and/or VPNs.
Start by making sure that your machine can access the website on your browser. Then, establish a Local Testing connection if you haven’t already by following the steps listed in enabling Local Testing.
If your Website / VPN / Firewall / Proxy only accept connections from certain IP addresses or Subnet addresses then it is mandatory to enabled “Force Local”. You can enable it in either of the following ways
- From Live Dashboard
- Navigate to http://localhost:45454, and enter your key and toggle force local on
- Use the force local flag if you are connecting via binary as shown below
BrowserStackLocal --key YOUR_ACCESS_KEY --force-local
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!