Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load site on localhost with iOS devices on BrowserStack Automate

I'm hosting a .NET Core HTTP application on localhost using Kestrel on an available port for some browser-based UI tests, but when trying to access it using real iOS devices with BrowserStack Automate with BrowserStackLocal.exe, Safari consistently refuses load the page.

I've tried various parts of the IP ranges documented here, but none have been successful. Desktop browsers (Chrome, IE, Edge and Firefox on Windows, Safari on macOS Mojave) and real Android devices work as expected.

I've also tried using the local IP address of the machine and the fully-qualified domain name (FQDN) as described here, but neither work portably as Windows Firewall blocks the connections even through BrowserStack Automate can resolve the address.

Port 80 is not a viable solution as developers' machines will have IIS running on their machines using that port, so it is not available for other purposes.

Given the following constraints, what are the workable solutions?

  1. Hosted on HTTP.
  2. Runs without admin privileges (i.e. no reconfiguring the firewall or using privileged port numbers <1024).
  3. At least two possible port numbers to use so that if one is in use there's at least one alternate to try.
  4. No additional manual setup required to run the tests (should just be the command dotnet test).
like image 697
Martin Costello Avatar asked Oct 28 '18 17:10

Martin Costello


2 Answers

On the iOS devices, try resolving http://bs-local.com:5000 instead of http://localhost:5000.

like image 161
Mukesh Tiwari Avatar answered Oct 05 '22 22:10

Mukesh Tiwari


You can access the site using http://bs-local.com:5000, But make sure to disable the host check for webpack using disableHostCheck: true in configuration.

For angular cli users, to disable to the host check you need to use --disable-host-check like ng serve --port 4200 --disable-host-check

like image 37
Aniruddha Das Avatar answered Oct 05 '22 23:10

Aniruddha Das