Firefox not taking note of /etc/hosts?

3

I've set foo.com to 127.0.0.1 in my /etc/hosts file in (located here on Windows: C:\Windows\System32\drivers\etc\hosts).

Though Chrome loads foo.com with the one hosted locally on port 80, Firefox loads the actual foo.com.

How do I get Firefox to load my locally pointed foo.com?

A T

Posted 2012-06-16T15:00:48.107

Reputation: 641

Firefox doesn't do that. It uses the OS DNS resolver to convert names to IP addresses. So it depends on how the resolver is configured. Applications such as Firefox have nothing to do with it. – Keith – 2012-06-16T15:02:38.990

So how do I configure its resolver to resolve foo.com as 127.0.0.1? – A T – 2012-06-16T16:10:50.143

Does Firefox have a proxy manually configured? If so DNS will be offloaded to the proxy server. – Zoredache – 2012-06-16T17:29:12.603

@AT That's a Windows admin thing, and I don't do Windows. The fact that that file is in a directory named "drivers" is completely bizarre. I think there is some GUI tool to set these. – Keith – 2012-06-16T17:53:29.593

@Zoredache Nope, it has precisely the same proxy settings as Chrome. Keith: Not sure. – A T – 2012-06-16T18:29:02.420

Answers

1

@guns answer to another question (about DNS lookup) helped me out on this issue. Basically, if a site has an IPv6 address, you need that in your hosts file, too.

127.0.0.1 foo.com
::1 foo.com

user43031

Posted 2012-06-16T15:00:48.107

Reputation: 121

0

set both www and non-www version of domain name at /etc/hosts

127.0.0.1 foo.com
127.0.0.1 www.foo.com

It is because firefox checks www.foo.com domain after initial DNS response of no server at foo.com

Rijul Sudhir

Posted 2012-06-16T15:00:48.107

Reputation: 111

0

This can be an issue due to a new feature called "DNS over HTTPS" (DoH).

To disable DNS over HTTPS go to Options -> General -> Network Settings. Then scroll down and deselect the checkmark in 'Enable DNS over HTTPs'

(In other languages, this is called differently, but should be found in Settings, if you search for "DNS")

rubo77

Posted 2012-06-16T15:00:48.107

Reputation: 2 822

0

I've ran into this problem before. It seems like Firefox is caching the /etc/hosts file in some fashion. Give it some time.

laughingbovine

Posted 2012-06-16T15:00:48.107

Reputation: 121

how do you force to clear it? I tried 'Clear your history' but that didn't help – rubo77 – 2020-02-12T01:38:29.133