6

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

/etc/hosts file:

127.0.0.1   domain.com

MAMP Vhosts config

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

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?

2
  • Have you tried with a blank Chrome profile, in case it's a setting/extension?
    – grg
    Commented Dec 15, 2013 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
    Commented Dec 15, 2013 at 19:12

1 Answer 1

9

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

127.0.0.1   localhost domain.com

See this StackOverflow thread.

1
  • You should mark this as the correct answer. :) Commented Apr 21, 2014 at 15:03

You must log in to answer this question.

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