I'm developing a local website with MAMP. I've configured a virtual host (hosts files, and apache vhosts).

/etc/hosts file:   domain.com

MAMP Vhosts config

<VirtualHost *:80>
    DocumentRoot "/route/to/folder"
    ServerName domain.com

It all works fine, but in Chrome sometimes the local website takes a few seconds to load, when it should load instantly. I've narrowed down the problem to Chrome as it works fine 100% of the time with Safari.

When this happens in Chrome, the status bar at the bottom says "resolving host". It would seem like it's waiting for a DNS server to respond... but isn't the hosts file overriding any DNS calls?

Any ideas what might be happening?

  • Have you tried with a blank Chrome profile, in case it's a setting/extension? – grg Dec 15 '13 at 19:05
  • I've disabled all extensions and the problem persists... As for the settings, I don't see what could be causing this. – Pier Dec 15 '13 at 19:12

The solution was to move the domain in the /etc/hosts file to the same entry as localhost.   localhost domain.com

See this StackOverflow thread.

| improve this answer | |
  • You should mark this as the correct answer. :) – thegreyspot Apr 21 '14 at 15:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .