NashTech Blog

How to test your app is behind a proxy in Browserstack

Picture of Dung Nguyen
Dung Nguyen
Table of Contents

1. Context

On BrowserStack remote devices, your app can retrieve data from publicly-hosted servers. However, your app cannot directly connect to servers that are hosted privately or behind a proxy, firewall, or VPN. To connect to such servers, the BrowserStack infrastructure requires some kind of network tunneling.

Local Testing creates a network tunnel between your private network and the BrowserStack infrastructure. This allows the BrowserStack remote devices to access the non-public servers hosted in your internal environments. To create this network tunnel, the Local app or binary needs to be installed on your local system that has access to the non-public server.

2. Set up Local Testing

Download and install BrowserStackLocal app or binary
Lauch BrowserStackLocal
In case of using BrowserStackLocal binary, go to the directory that contains the BrowserStackLocal binary and Run the following command:
BrowserStackLocal --key <YourBrowserStackAccessKey> –force-proxy
Open Local Console (http://localhost:45454).
In the Tunnel Settings pane, apply the following settings:
– Enable the Force Local flag
– Enable the Force Proxy flag
– Enter your Proxy host and port
– Click Update Command

3. Run your test

Now you can enable the Force Local and Force Proxy flags to force BrowserStackLocal to resolve all connections through your local network or proxy, instead of resolving the requests through the public internet.
– The Force Local flag ensures that any resolution of URLs that your BrowserStack device does will be routed through the Local tunnel
– The Force Proxy flag routes all traffic through the proxy you configured
Start App Live on your selected device. On the toolbar, you can see that Force Local is on. And now you can test your app is behind a proxy

4. References

BrowserStack App Live | BrowserStack Docs

Picture of Dung Nguyen

Dung Nguyen

I'm be here as a Senior Automation Test Engineer for nearly 10 years. I've experienced on many automation frameworks and tools like Selenium with variety of programming languages, Cypress, RobotFW, TestComplete...I also play more on performance API testing using Jmeter.

Leave a Comment

Suggested Article

Discover more from NashTech Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading