Why can’t I acces the Mac’s webserver from the iPhone using the Mac’s ad-hoc WiFi

ad hocwifi

I want to do a demo of an iPhone optimised WebApp using my MacBook Air with a local server, so I don't have to depend on getting an internet connection or WiFi access from my client.

The Air is running Lion 10.7.2 and the iPhone is on iOS 5.0.1.

When I create a network on the Mac I can join from the iPhone, but when I open "http://my-macbook-air/" in Safari, it doesn't work.

Strangely it doesn't seem to utilize the WiFi, as the indicator never appears (but shows connected in the Settings app).

Possibly related:
Why is my iPhone unable to connect to an ad hoc wifi network? (though my question is Apple <-> Apple, so I expected it to work).

Best Answer

It is probably related to resolving the host name.

Try using the IP address of the Mac instead of the name:

enter image description here