Troubleshooting Local Testing issues in iOS
A guide for solving known issues that you might face while testing locally in iOS sessions.
This guide assumes you have completed local-testing setup and are in a local session, indicated by the “green” status icon on the Local Testing entry in the toolbar. See Set up Local Testing to learn how to set up a local session.
Sometimes it might happen that although your localhost
server is accessible on your local machine, it fails to resolve or load in a local-enabled iOS session in App Live.
This issue can occur due some of the following common reasons:
Failure to connect to localhost via bs-local.com
Cause:
iOS restricts the resolution of localhost
requests outside the device due to security reasons. Given this technical constraint on iOS devices, directly accessing the server hosted on your local machine through the localhost
URL or via 127.0.0.1
is not supported in iOS sessions.
The localhost
URL is automatically changed to bs-local.com
which resolves to 127.0.0.1
as well and allows that request to be resolved on your local machine. Though we try to ensure that localhost
is changed to bs-local.com
automatically, there might be intermittent cases where this doesn’t happen automatically. This is not supported in iOS-Chrome sessions.
Resolution: You can try one of the following resolutions:
-
Use bs-local.com to access localhost: To access localhost servers in iOS sessions, ensure that you replace
localhost
withbs-local.com
in the URL. Thoughlocalhost
is automatically changed tobs-local.com
in iOS-Safari sessions, verify that the URL usesbs-local.com
in case it is not changed automatically. -
Use your private IP address: Alternatively, you may also use the private IP address of your local machine to access the
localhost
server. In this case, replacelocalhost
with<private IP address>
in the URL.
Hostname restrictions in local server configuration
Even after accessing the localhost
server via the bs-local.com
hostname, you might still see additional errors.
Cause:
This issue occurs when your local HTTP server disallows your localhost
server to be accessed via the bs-local.com
URL. When your app tries to access your localhost
server via bs-local.com
, the request to the localhost
server might include the hostname: bs-local.com
header. In their default configuration, some servers block all HTTP(S) requests where this hostname
header takes a value other than localhost
.
Resolution:
Configure your server to accept requests from bs-local.com
. The exact steps to do this differ based on the server you are using.
For some widely-used servers, such as development servers bundled in web-app frameworks, you may use the following configuration steps. If steps for your server are not listed here, refer to the documentation of the respective server.
By default, Angular does not allow the dev server to accept requests from custom domain names (such as bs-local.com
). It can be configured to do so using the following steps:
Kill the server and restart it by running the following command:
You should now be able to access your localhost
server via bs-local.com
.
By default, Webpack does not allow the dev server to accept requests from custom domain names (such as bs-local.com
). Edit the webpack.config.js
file of your server to accept custom domains using the following steps:
-
Using a text editor of your choice, open the
webpack.config.js
file and navigate to thedevServer
section. -
Add the following lines of code under the
devServer
section of yourwebpack.config.js
file:
- Save the file and restart the server.
You should now be able to access your localhost
server hosted on Webpack’s dev server via bs-local.com
By default, Vue does not allow the dev server to accept requests from custom domain names (such as bs-local.com
). Edit the vue.config.js
file to accept custom domains using the following steps:
-
Using a text editor of your choice open the
vue.config.js
file located in project directory. If you can’t find this file, create this in the root of your project directory. -
Add the following lines of code to the file:
- Save the file and restart the server
You should now be able to access your localhost
server hosted on Vue’s dev server via bs-local.com
.
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!