0

The use case is that we are testing a site that runs on a local machine.

I know how to access the site (How do you access a website running on localhost from iPhone browser), but there are redirects to "localhost".

Is there any way to set localhost to an IP address on iPhone?

Community
  • 1
  • 1
B Seven
  • 44,484
  • 66
  • 240
  • 385

2 Answers2

3

localhost is a loopback address. So you cannot access a website hosted on iPhone or any device remotely using 127.0.0.1. You would just access the site using the whatever IP address was assigned by DHCP.

Yes, you can set the IP Address of the Wi-Fi connection under Settings --> WiFi. WiFi settings

Black Frog
  • 11,595
  • 1
  • 35
  • 66
0

Well, the IP address for localhost is 127.0.0.1 but you can't access your phone's localhost because it's not an Apache server? You can only access your app's directory eg. Documents.

And Apple doesn't allow you to access your iPhone's root folder, if you wanted to access this.

If you want to view websites from another computer's localhost you need to use that machine's internal IP address (eg. 192.168.0.1) if you are on the same WiFi/LAN network.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
emotality
  • 12,795
  • 4
  • 39
  • 60