Chrome does not follow hosts file

6

I have custom domains set up for internal web site testing in my /etc/hosts file.

I try to access them in Chrome, and I get routed to a Google search instead. But when I ping the domains, they show that they are working.

What should I do to make sure I can access these sites in Chrome?

psion

Posted 2012-08-17T02:34:42.877

Reputation: 201

Chrome dev team says they WontFix this. The extension Host Switch Plus does not work for me.

– zylstra – 2017-03-18T01:37:02.003

Answers

4

Disable "Use a web service to help resolve navigation errors" in Chrome's Settings under Privacy. Try flushing Chrome's cache after disabling this and see if it works then.

Kale Muscarella

Posted 2012-08-17T02:34:42.877

Reputation: 1 080

1This is a less-optimal way of solving it. Without http:// in front of the domain, Chrome may assume that you've made a "navigation error" / lazy search. With http:// it shouldn't argue. – BowlesCR – 2014-01-29T18:20:43.457

4

You can just throw an http:// in front of your local address; that worked for me.

Derek DeRaps

Posted 2012-08-17T02:34:42.877

Reputation: 49

Doesn't worked for me. The Chome just writes «Couldn't retrieve URL», although plain ping there works like a charm. – Hi-Angel – 2014-09-30T12:26:10.200

This should do it. By declaring the http:// protocol up front Chrome should assume you know what you're doing and just try the address as given instead of trying to be helpful. – BowlesCR – 2014-01-29T18:22:44.373

4

As the answer in stackoverflow, the solution for me was adding ::1 in /etc/hosts like:

127.0.0.1 foo.domain.local
::1 foo.domain.local

konus

Posted 2012-08-17T02:34:42.877

Reputation: 143

1This really shouldn't affect the situation unless you're trying to override the domain name of a real site that happens to be IPv6 enabled and point it back to your local machine. – BowlesCR – 2014-01-29T18:21:37.150

2

just use the domains like so http://localstite.dev/ .

It's the "/" at the end to resolve the host...

Phil

Posted 2012-08-17T02:34:42.877

Reputation: 21

0

In /etc/hosts list them like this:

192.168.0.4 foo.localdomain

Now when you type foo.domain in the address bar it will still return search results but you should see a bar asking you if you meant to go to foo.localdomain instead.

Strangely once I had got Chrome to do this once it started doing it for single host names in /etc/hosts but I had to use the host.domain form first.

tallus

Posted 2012-08-17T02:34:42.877

Reputation: 111

I don't even get that bar. It's a fully-qualified domain name too. – psion – 2012-08-17T03:43:43.033