IPv6 and localhost
A service listens on 127.0.0.1:8080. curl http://localhost:8080 sometimes takes a second longer before succeeding. Why?
127.0.0.1:8080
curl http://localhost:8080
Choose one answer
It resolves to ::1 first, which is refused.
::1
The service needs a second to accept IPv4 connections.
localhost is always resolved through a public DNS server before /etc/hosts.
localhost
/etc/hosts
curl adds an artificial delay for loopback addresses.