I've encountered a really strange Mac problem: Safari is unable to connect to localhost whereas all other applications can connect as normal (Firefox, Chrome, ping, etc.).
My /etc/hosts is the standard setup:
$ egrep localhost /etc/hosts
# localhost is used to configure the loopback interface
127.0.0.1 localhost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 testing.localhost
Question: Have anyone else encountered this? What could be the problem?
Update #1: I have a server running on localhost:8080. When accessing from Safari I get the error message "Safari could not connect to the server". "http://localhost:8080/" works flawlessly in Firefox and Chrome.
Update #2: Same problem with "http://127.0.0.1:8080/" - so it does not seem to be related to resolving localhost to 127.0.0.1.
/etc/hosts
as above and IPv6 left at its default automatic, requesting 127.0.0.1:8080 makes Safari use IPv4 (which could still connect to a server providing IPv6). Requesting localhost:8080 makes Safari use IPv6.