Search code examples
proxybrowserstack

BrowserStackLocal with proxy giving Error: Could not connect to www.browserstack.com


BrowserStackLocal gives Error: Could not connect to www.browserstack.com!

I am trying to use Charles Proxy with BrowserStackLocal. I want to use Rewrite feature of Charles Proxy. Both Charles Proxy and BrowserStackLocal are running on same Mac Laptop.

I am getting following error. Has anybody run into this problem?

$ ./BrowserStackLocal myKey -proxyHost 192.168.160.113 -proxyPort 8888 -force -forcelocal
BrowserStackLocal v5.5

*** Error: Could not connect to www.browserstack.com!

Configuration Options:
-v
 Provides verbose logging
-f
 If you want to test local folder rather internal server
-h
 Prints this help
-version
 Displays the version
-force
 Kill other running Browserstack Local
-only
 Restricts Local Testing access to specified local servers and/or folders
-forcelocal
 Route all traffic via local machine
-onlyAutomate
 Disable Live Testing and Screenshots, just test Automate
-proxyHost HOST
Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
-proxyPort PORT
Port for the proxy, defaults to 3128 when -proxyHost is used
-proxyUser USERNAME
Username for connecting to proxy (Basic Auth Only)
-proxyPass PASSWORD
Password for USERNAME, will be ignored if USERNAME is empty or not specified
-localIdentifier SOME_STRING
If doing simultaneous multiple local testing connections, set this uniquely for different processes

To test an internal server, run:
./BrowserStackLocal <KEY>
Example:
./BrowserStackLocal DsVSdoJPBi2z44sbGFx1

To test HTML files, run:
./BrowserStackLocal -f <KEY> <full path to local folder>
Example:
./BrowserStackLocal -f DsVSdoJPBi2z44sbGFx1 /Applications/MAMP/htdocs/example/

View more configuration options at http://www.browserstack.com/local-testing

Solution

  • Charles Proxy generates its own certificates which is signed by 'Charles Root Certificate'. It seems Charles Proxy is modifying the certificate used by BrowserStackLocal due to which the request to BrowserStack fails and you receive "Could not connect to www.browserstack.com!". More information on SSL-Certificates and Charles is available here.

    Can you disable this setting in Charles? This will allow BrowserStackLocal use its original certificate and connect to BrowserStack.