safarilocalhosthostssymlink-traversal

Why can't Safari connect to localhost?


I have a proper /etc/hosts file with the following contents:

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost

When I try to access a server I have running on my local computer, whether it is Apache on port 80, or another server running on another port, I can't access it in Safari. Yet I can access them just fine in Chrome. Why is this?


Solution

  • It turned out that I forgot I had made a symlink for /etc/hosts to a file I store elsewhere so I always have access to it if my system crashes, etc. Apparently, Safari doesn't follow the symlink for /etc/hosts. I made a hard link so I have a copy elsewhere, and now Safari recognizes localhost servers.