An issue I’ve encountered with MAMP Pro since having upgraded to OS X Lion was that requests to vhosts served via MAMP took their time to load: after about 3 to 5 seconds of loading, the site would finally load.
The most tricky part in this issue is that it only happens if you have a domain ending in
.local, such as
mysite.local. If you’d rename the site to
mysite.dev, it’d be — … beware, buzzword coming up … — snappy again.
The Multicast DNS feature of Bonjour technology allows devices on a local network to connect to each other by name without a separate DNS server. By default, any hostname ending in .local is treated as a Bonjour host rather than by querying the DNS server entries in Network preferences.
Though the .local domain is not defined as a valid top-level domain on the Internet, some private networks have DNS servers that assign hostnames in the .local domain. By default Mac OS X does not use the DNS server to resolve these names. This may result in unexpected failures to connect to .local hostnames defined by your server.
To fix this problem (without having to rename each vhost) you need to add IPv6 entries for each of your vhosts in your
::1 mysite.local fe80::1%lo0 mysite.local 127.0.0.1 mysite.local
.local vhosts load fast again. I’ve created an issue on the MAMP bug tracker for this, requesting the author to automatically add IPv6 entries to the hosts file when creating/editing a vhost. Hope to see this fixed in a future version. For now, the fix above will have to do.
Note that after restarting MAMP, the IPv6 entries will be gone … yeah, so that bug needs to fixed soon (either by Apple, or by MAMP). If you don’t want all the hassle after a restart, you might consider renaming your vhosts to
.dev (anything but
.local will do)
## # 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 mysite.local myothersite.local anothersite.local yetanothersite.local fe80::1%lo0 localhost 127.0.0.1 mysite.local 127.0.0.1 myothersite.local 127.0.0.1 anothersite.local 127.0.0.1 yetanothersite.local
Like what you see? Make a donation.
It certainly is no obligation but it would put a smile on my face 😉