bazi
bazi

Reputation: 1866

How to make react-native use the hosts file in Mac OS X El Capitan?

I've added a new entry in my /etc/hosts file and its not reflecting in the IOS Simulator. I'm using OS X El Capitan. This is my hosts file

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost

192.168.10.10   homestead.app

I can access homestead.app from the simulator's Safari web browser but I cannot access from my react-native app. I have tried restarting simulator, restarting Mac, resetting the simulator settings but it's not working.

Upvotes: 0

Views: 1224

Answers (1)

russbishop
russbishop

Reputation: 17219

The Simulator is a separate userspace running on the host macOS kernel. All networking is handled by the kernel, so there is nothing special about the Simulator per-se. If Safari in the Simulator can resolve the host then it is working. The problem may be somewhere in your app, the app transport policy blocking a non-SSL connection, or if you are serving with a self-generated cert it could be a trust issue.

Upvotes: 2

Related Questions