Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing localhost from iPhone (in same network)

I want to test my iPhone web Application developed in localhost (XAMPP) in my iPhone. My system IP is 192.168.1.1 in the local network.

When I visit http://192.168.1.1:80 in the browser, it says "The server 192.168.1.1:80 at DSL Router requires a username and password".

I thought it must be my XAMPP username/password but it seems it is not and it shows a 404 error.

Both my system and my iPhone are in the same network. So where am I doing it wrong?

like image 832
ptamzz Avatar asked Apr 14 '11 15:04

ptamzz


People also ask

Can I access localhost from Internet?

It's possible through secure tunnel services online! These are services that provide you with a tunnel from the Internet to your machine. What that means is that they provide a publicly accessible URL, watch for calls on that URL, and forward those calls to your localhost server.

Can I access localhost from another device?

You can access your host machine with the IP address "10.0. 2.2". This has been designed in this way by the Android team. So your webserver can perfectly run at localhost and from your Android app you can access it via "http://10.0.2.2:8080".


1 Answers

Check to make sure your IP is correct for your host machine.

Windows: Windows + R -> type "cmd"

ipconfig

*unix:

ifconfig

Usually 192.168.0.1 or 192.168.1.1 are allocated to your router, which is what you are seeing via your iPhone.

like image 114
Easen Avatar answered Sep 21 '22 18:09

Easen