ERR_CONNECTION_REFUSED for localhost addresses on Chrome

I run my development environments with a Vagrant VM for each, with each project mapped to *.localhost in /etc/hosts. So I can access project1.localhost, project2.localhost, etc.

Unfortunately as of yesterday, these addresses all completely stopped working in Chrome, instead giving an ERR_CONNECTION_REFUSED message. The strange thing was that I could still access the project directly by IP, and the *.localhost addresses still worked perfectly in Safari and Firefox.

It actually turns out that this is a new security feature introduced in Chrome 43, which blocks any subdomains of localhost from being accessed from the web. Specifically this means URLs ending with .localhost. You can see an in depth explanation of the issue here and here.

The solution is either to use a different browser (but no doubt other browser will also implement this measure at some point), or to simply change your domain names. I have changed everything from .localhost to .local and everything works as normal.


  1. Thanks! I was running my dev environments in the same way and frustratingly started getting the same problem. This helped clarify why.

  2. Try this also:

    Chrome > Preferences > Clear Browser History > The beginning of time / whenever > tick only CACHED IMAGES AND FILES, then Clear your browsing history

    I’ve had this issue a few times using `.dev`

    1. I had to do this for a similar issue in Grails. Clearing the cache allowed me to just refresh the page and the error was gone. Thanks!

  3. I use xammp and have several development host names all set within the httpd-vhosts.conf and etc/host.
    None of these work anymore in Chrome but work in ALL other browsers. I receive the error “This site can’t be reached” ERR_CONNECTION_REFUSED. Changing the domain names does not fix the issue since I have several of those. I have set all my sites to,,, ect. I have cleared by cashe and history to no effect and have tried many suggestions found on google search.

  4. Thanks for the tips. My favorite development domain was “.dev”. I changed it for “.local” and it works 🙂

  5. Hey,

    Someone with this problem in 2018?

    Anyone have a solution? I am using mac with windows in VM with parallels. I cant run the api in “local”.


Leave a Reply

Your email address will not be published. Required fields are marked *