Saturday, April 9, 2016

Fixing HTTP latencies for `.local` hosts in /etc/hosts in Mac OSX 10.11.4 (El Capitan)

I have a problem on my Mac.

So I have a web-server on my localhost under `app.local` virtual server in Nginx config. When I make requests to it I notice that it takes cca. 5 seconds per requests. Looks pretty much as a timeout for DNS resolution.

The problem is known and there are several solution in the Internet. But only this helped me:

`etc/hosts`:

127.0.0.1 app.local
::1 app.local

So this trick is to specify IPv6 address too. And put hosts one per line -- hosts after the first one are ignored (a bug?).

No comments:

Post a Comment