Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View local web server on Mac with computer name, not IP

I have MAMP installed on my Mac with OS X 10.6. This computer's name is chocolate.

If I want to view pages on chocolate with chocolate, in the address bar of a browser I can type localhost/. If I want to view pages on chocolate from another Mac or an iOS device (e.g. an iPad) I can type chocolate.local.

However, when I type in chocolate.local on my Android phone's stock browser, I get a search results page. If I type http://chocolate.local/, I get a "Web page not available" message.

But I can use the IP address of chocolate to connect from my Android. Is it not possible to connect to a local web server on a Mac with Android by using computername.local?

like image 420
charles Avatar asked Aug 26 '11 00:08

charles


People also ask

How do I use name instead of IP address?

Use the host name set to the data file on the DNS server. Use the machine name on the configuration page as the host name. Add the IP address and host name of the network machine to the hosts file on the computer used for printing. Methods of addition vary depending on operating systems.

How do I find my server URL on a Mac?

On your Mac, choose Apple menu > System Preferences, then click Sharing . Your computer's local hostname is displayed beneath the computer's name at the top of Sharing preferences.


1 Answers

In short, no the Android device will not be able to by default access your Mac by a .local address. On Macs, ".local" generally will be attempted to be resolved via mDNS (Zeroconf/Bonjour).

The Android operating system does not have built-in support for mDNS (although specific applications can implement it using a library, the default web browser is not one which does). Android resolves domain names through standard DNS, which, unless you run your own local DNS server, will not resolve your local network addresses (Such as .local). The Android device is either using your ISPs DNS server, or your routers DNS server that forwards to your ISP.

like image 179
Rajiv Makhijani Avatar answered Sep 20 '22 06:09

Rajiv Makhijani