Local Testing FAQs
Find answers to questions about connecting BrowserStack to your local and private environments, and fixes for common Local Testing errors.
The answers on this page apply to both the Local desktop app and the Local binary, unless an answer names one of them. If your question isn’t answered here, contact support.
Get started
How do I connect BrowserStack to my local environment?
Choose one of the following options based on the product and operating system you use:
- Local desktop app: Works on Windows and macOS. Use the app for Live and App Live.
- Download, install, and launch the Local desktop app.
- Start a Live or App Live session. The Local desktop app connects automatically.
- If the connection fails or your URL doesn’t open, go to the Local Console at
http://localhost:45454. Follow the steps in Configure the Local desktop app.
- Local binary: Works across all operating systems. Use the binary for Automate and App Automate, and for Live and App Live on Linux, where the desktop app isn’t available.
- Download the binary for your OS from Releases and downloads.
-
Run the binary from the command line with your access key:
./BrowserStackLocal --key YOUR_ACCESS_KEYOn Windows, run
BrowserStackLocal.exe --key YOUR_ACCESS_KEYinstead. - In your automated tests, set the
browserstack.localcapability totrue. If you use abrowserstack.ymlfile, setbrowserstackLocal: trueinstead.
To customize the connection, such as when routing traffic through a proxy, add the flags for Local.
Can I test a server that is only accessible through a VPN or behind a firewall?
Yes. Local Testing reaches any server that your machine can reach, including servers behind a VPN or a firewall.
- Confirm that you can open the private server from a browser on your machine. If the server is behind a VPN, connect to the VPN first.
- On the same machine, start the Local desktop app or Local binary.
- In your BrowserStack session, open the same private server URL that you use on your machine.
If your machine connects to the internet through a corporate proxy, provide the proxy details to the binary using the --proxy-host and --proxy-port flags, or use a PAC file. To make sure all requests go through your machine instead of the public internet, add the --force-local flag.
For more information, see How Local Testing works.
Can I test multiple local sites hosted on different virtual hosts?
Yes. After Local Testing is connected, open each site in the remote browser using the same hostname you use on your machine, for example, http://site-a.local and http://site-b.local. You don’t need a separate connection for each site.
Local Testing resolves hostnames from your machine. Any virtual host that opens in your local browser opens in the BrowserStack session, including hosts in your hosts file.
To limit which hosts are routed through the Local connection, use the --include-hosts or --only flags.
Network access
Can I use IP Geolocation and Local Testing in the same session?
No. IP Geolocation and Local Testing can’t run in the same session. IP Geolocation routes your traffic through a different country, which conflicts with the Local connection. When you set an IP location, BrowserStack automatically disables Local Testing for that session.
To test both scenarios, run your Local Testing and IP Geolocation tests in separate sessions.
Why do my TCP connections fail during Local Testing?
Local Testing carries HTTP and HTTPS traffic. Raw TCP socket requests fail for the following reasons:
- They don’t follow the HTTP request structure that the Local connection expects.
- They try to connect to your application directly over the internet instead of through the Local connection. If your application isn’t publicly accessible, as is common in local development, the connection fails.
To test your application with Local Testing, make sure it communicates over HTTP or HTTPS. If your application is publicly discoverable but restricted by IP address, you can also use IP whitelisting.
IP whitelisting
Can BrowserStack reach my IP-restricted server without the Local binary?
Yes. With IP whitelisting, BrowserStack accesses your server directly through a fixed set of IP addresses that your network administrator whitelists. Your test traffic doesn’t pass through the Local binary or the Local desktop app.
IP whitelisting works only for servers that are publicly discoverable, such as private.example.com, but restricted by IP address.
For details on how the connection works, see Inbound IP Whitelisting.
How many IP addresses do I need to whitelist?
The number of IP addresses you need to whitelist depends on the type of access you choose:
- Shared IP whitelisting: You whitelist the IP addresses of BrowserStack’s entire shared fleet.
- Dedicated IP whitelisting: BrowserStack allocates a dedicated machine that connects only to your network, reducing the number of IP addresses you need to whitelist.
BrowserStack shares the list of IP addresses with your organization when you set up the feature.
Can I use IP whitelisting to access localhost or other non-public parts of my network?
No. IP whitelisting can’t reach localhost or other parts of your network that aren’t publicly discoverable. To test these, use the Local binary or the Local desktop app.
I use both the Local binary and IP whitelisting. Which connection does BrowserStack use?
IP whitelisting takes priority by default. To route your session through the Local binary instead, explicitly enable Local Testing in your test configuration in one of the following ways:
- In your capabilities, set
browserstack.localtotrue. - In your
browserstack.ymlfile, setbrowserstackLocal: true.
How do I get started with IP whitelisting?
IP whitelisting is an Enterprise feature. If you have an Enterprise plan, contact support to enable it and get the IP addresses to whitelist. Otherwise, contact sales.
Safari and iOS
Why don't my localhost or private URLs open in Safari on macOS or iOS?
Safari on macOS and iOS has known issues with opening URLs that contain localhost. To fix this, try the following options:
- Use your machine’s IP address instead of
localhost: Keep the same port and path. For example, changehttp://localhost:3000/logintohttp://192.168.1.10:3000/login. - Use a supported port: Older Safari versions accept only specific ports. To check whether your port is supported, see Which ports can I use to test my local or private server?.
- On iOS 10 and later, use
bs-local.com: See Why does localhost change to bs-local.com in my session?.
If the issue persists, contact support.
Which ports can I use to test my local or private server?
On all browsers except Safari 8 to 11, you can use any port.
On Safari 8 to 11 on macOS and iOS, run your local server on one of the following ports:
22, 80, 81, 443, 1010, 1111, 1185, 1201, 1234, 1313, 1337, 1400, 1534, 1535, 1776, 1859, 1999, 2000, 2016, 2022, 2100, 2101, 2104, 2222, 3000 to 3012, 3020, 3025, 3030, 3039, 3050, 3090, 3093, 3099, 3100, 3128, 3200, 3300, 3306, 3330, 3333, 3334, 3335, 3535, 3621, 3778, 3791, 4000, 4001, 4002, 4003, 4018, 4021, 4040, 4100, 4200, 4201, 4202, 4203, 4207, 4209, 4211, 4232, 4242, 4250, 4300, 4400, 4443, 4444, 4500, 4502, 4503, 4567, 4568, 4600, 4702, 5000, 5001, 5002, 5003, 5005, 5006, 5010, 5015, 5020, 5026, 5050, 5051, 5200, 5250, 5443, 5500, 5501, 5502, 5757, 5790, 6006, 6007, 6009, 6010, 6060, 6080, 6567, 7000, 7001, 7005, 7009, 7071, 7072, 7152, 7200, 7443, 7456, 7774, 7777, 8000, 8001, 8002, 8003, 8004, 8005, 8007, 8008, 8011, 8020, 8031, 8050, 8063, 8070, 8080 to 8092, 8096, 8100, 8101, 8103, 8108, 8443, 8500, 8686, 8760, 8800, 8848, 8887, 8888, 8889, 8890, 8899, 9000 to 9100, 9200 to 9400, 9601, 9606, 9876, 9877, 9880, 9898, 9900 to 9999, 10000, 10002, 10039, 10358, 11085, 12001, 13000, 13260, 14357, 19006, 22081, 25600, 31033, 31832, 33995, 38946, 40080, 40980, 43500, 43501, 44300, 44303, 44304, 44305, 44307, 44313, 44322, 44323, 44327, 44332, 44335, 44343, 44344, 44345, 44346, 44358, 44359, 44368, 44373, 44382, 44398, 45454, 49190, 49660, 49772, 50208, 50291, 50425, 51528, 53124, 53541, 54134, 54136, 54457, 55555, 55595, 55739, 56978, 59353, 60778, 63342, 64000, 64900, 65508
If your port isn’t listed, switch your server to a listed port before you test on these Safari versions.
Why does localhost change to bs-local.com in my session?
Safari on iOS 10 and later doesn’t support http://localhost. When Local Testing is enabled, BrowserStack automatically replaces localhost with bs-local.com, which points to your machine. For example, http://localhost:3000/login opens as http://bs-local.com:3000/login.
- Manual testing: If
localhostdoesn’t open, or the URL doesn’t change automatically, enterbs-local.comin place oflocalhostyourself. - Automated testing: If API calls to a
localhostendpoint fail, update those endpoints to usebs-local.com.
If your machine uses a proxy server, add bs-local.com to your proxy bypass list so requests reach your local server.
Why are some images, styles, or scripts missing when I open my local site in Safari?
Remote Safari on iOS 10 and later can’t fetch assets that use absolute localhost URLs. To load your assets, follow these steps:
-
Change the asset URLs in your code to relative paths by removing prefixes such as
http://localhost,https://localhost,127.0.0.1,http://127.0.0.1, andhttps://127.0.0.1.For example, change
https://localhost/assets/style.cssto/assets/style.css. - Reload the page in your Safari session.
- To confirm that the assets load, open the same page in Chrome on an Android device from the Live dashboard.
If the assets still don’t load, contact support.
Errors and troubleshooting
The Local desktop app is running on my machine. Why doesn't BrowserStack detect it?
BrowserStack shows Local Testing as connected only after the Local desktop app connects to the BrowserStack backend. A running app is not enough. To find what blocks the connection, follow these steps:
- Open the Local Console at
http://localhost:45454.- If you see the connection dashboard, the app is connected. Go to step 3.
- If you see an Unable to connect error, your network blocks the connection. Go to step 2.
- Configure the app for your network, then retry the connection:
- If your network uses a proxy, enter the proxy host, port, and credentials in the Local Console. For a PAC file, enter its path instead.
- If your proxy uses SSL inspection, disable SSL inspection for BrowserStack Local, or ask your network administrator to exclude
*.browserstack.com.
For detailed steps, see Configure the Local desktop app.
- Make sure the access key in the Local Console belongs to the BrowserStack account that you use to start your session.
- Make sure no other process uses ports
45690and45691, which BrowserStack Local needs. An older version of the app, another user’s instance on the same machine, or a different program can occupy these ports. To check and fix each case, see Troubleshoot the Local desktop app. - If you upgraded from an older version of the app, check your Applications folder and uninstall any older version that is still there.
- Restart the Local desktop app and start a new session.
If BrowserStack still doesn’t detect the app, contact support.
How do I fix the spawn ETXTBSY error when starting the Local binary?
The spawn ETXTBSY error occurs when more than one copy of the Local binary exists in the same location and your test tries to start a copy that is already in use. To resolve this error, configure your tests to use a single binary by following these step:
- Download the Local binary for your OS from Releases and downloads and save it to a fixed location.
-
This step applies to the
browserstack-localNode.js package. InbsLocalArgs, setbinarypathto the absolute path of the binary, along with your access key:const bsLocalArgs = { key: 'YOUR_ACCESS_KEY', binarypath: '/absolute/path/to/BrowserStackLocal' }; - Run your tests again.
If you need to run several Local connections at the same time, assign a unique name to each connection using the --local-identifier flag.
How do I fix the 'self signed certificate in certificate chain' error?
These errors mean your network uses SSL inspection, which replaces the certificates that BrowserStack Local relies on to connect securely. Use one of the following solutions:
- Bypass BrowserStack: Ask your network administrator to exclude
*.browserstack.comfrom SSL inspection. - Disable SSL inspection: Turn off SSL inspection for BrowserStack Local traffic.
-
Trust your root certificate on Windows: Provide your organization’s root CA certificate to the Local binary as a
.pemfile.In your
browserstack.ymlfile:browserstackLocal: true browserStackLocalOptions: -use-ca-certificate: <PEM_file_abs_path>From the command line:
./BrowserStackLocal --key YOUR_ACCESS_KEY --force-local --use-ca-certificate <PEM_file_abs_path> -
Trust system certificates on macOS or Linux: Allow the Local binary to use the certificates installed on your machine. You don’t need a certificate file.
In your
browserstack.ymlfile:browserstackLocal: true browserStackLocalOptions: -use-system-installed-ca: trueFrom the command line:
./BrowserStackLocal --key YOUR_ACCESS_KEY --force-local --use-system-installed-ca
The root certificate options work only with the Local binary, not with the Local desktop app.
For more information, see Local Testing with SSL Inspection and Flags for Local.
How do I fix the 'Looks like you have SSL inspection enabled' error?
These errors mean your network uses SSL inspection, which replaces the certificates that BrowserStack Local relies on to connect securely. Use one of the following solutions:
- Bypass BrowserStack: Ask your network administrator to exclude
*.browserstack.comfrom SSL inspection. - Disable SSL inspection: Turn off SSL inspection for BrowserStack Local traffic.
-
Trust your root certificate on Windows: Provide your organization’s root CA certificate to the Local binary as a
.pemfile.In your
browserstack.ymlfile:browserstackLocal: true browserStackLocalOptions: -use-ca-certificate: <PEM_file_abs_path>From the command line:
./BrowserStackLocal --key YOUR_ACCESS_KEY --force-local --use-ca-certificate <PEM_file_abs_path> -
Trust system certificates on macOS or Linux: Allow the Local binary to use the certificates installed on your machine. You don’t need a certificate file.
In your
browserstack.ymlfile:browserstackLocal: true browserStackLocalOptions: -use-system-installed-ca: trueFrom the command line:
./BrowserStackLocal --key YOUR_ACCESS_KEY --force-local --use-system-installed-ca
The root certificate options work only with the Local binary, not with the Local desktop app.
For more information, see Local Testing with SSL Inspection and Flags for Local.
Why do my logs show 'Connection Restricted: Your websocket connections have exceeded the allowed limit'?
Your account has exceeded the per-user limit for open WebSocket connections. BrowserStack enforces this limit to keep sessions stable for everyone, and it automatically blocks the extra connections.
To fix this, follow these steps:
- Close idle connections on your side, such as unused sessions, tabs, or test runners that are still connected.
- Wait a few minutes, then run your tests again.
If you still see the message, contact support.
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!