Entry in /etc/hosts file always redirects to localhost (mac)

I’m use Local for 90% of my local dev work, but I’m now working with a larger team that uses Docker for local work. The site has strict API requirements. I’ve added an entry in my /etc/hosts files for localhost.example.com that will satisfy CORS, but every time I use the new URL, it jumps back to localhost, no matter what browser.

Could this be because of Local? No one else on my team has this issue.
Is there documentation on how Local handles the hosts file?

Any feedback would be appreciated.


Could you clarify if the localhost.example.com is the Local site? When you hit that URL where does it goto?

One suggestion is to ensure that IPV6 Loopback is set in Local. You can do that here:

  1. System Preferences
  2. Advanced
  3. Ensure that IPv6 Loopback is enabled / on.
  4. Click Apply.

Thanks for the reply Andy. Turns out that it was simply the URL set in the wp-options table of the database, but due to my unfamiliarity with Docker, I didn’t check that.