5

I tried to block some hosts to load from them ads and scripts. for example in /etc/hosts:

127.0.0.1 web-visor.com
0.0.0.0   c1.web-visor.com

Why after editing and saving the file, firefox (after restart) still load this sites (not from cache of course)?

My /etc/host.conf seems to search previously in hosts file

order hosts,bind
multi on

What's wrong?

4 Answers 4

2

host.conf is obsolete, look in nsswitch.conf .

2
  • Do you know how to use it instead of /etc/hosts? Because the manual doesn't seem to give even a little hint, and I couldn't find an examples about that. /etc/hosts can't supposed to be obsolete until the new one can execute it's functions. From manual I am doubt that it is.
    – Hi-Angel
    Sep 30, 2014 at 13:56
  • 1
    /etc/host.conf is obsolete, /etc/hosts isn't. nsswitch.conf decides whether and how /etc/hosts is used.
    – Tobu
    Oct 1, 2014 at 13:28
1

Does your Firefox use proxy? /etc/hosts SHOULD effect your Firefox (I tested it). What is the result of pinging those addresses?

2
  • 1
    How did you test this? In my experience, a proxy overrides /etc/hosts.
    – SabreWolfy
    Feb 28, 2013 at 11:16
  • If you turn on the feature that intranet addresses should not use proxy, then /etc/hosts should no be overridden by the proxy (technically it is not an override, the domain you try to reach will be sent to the proxy, and the proxy will re-resolve it by its own DNS which will return a correct IP).
    – karatedog
    Feb 28, 2013 at 15:13
1

put www version of domain also in /etc/hosts.

127.0.0.1 web-visor.com
127.0.0.1 www.web-visor.com

It is because firefox tries to resolve www.web-visor.com as well.

1
  • This did not work for me.
    – JayRizzo
    May 14, 2018 at 6:06
0
# =============================================================================
# URL: https://ss64.com/osx/fc.html 
#      The ad at the bottom
# Computer: MacBook Pro OSX 10.13.4
# Browser: Firefox Quantum 59.0.2 (64-bit)
# Problem: /etc/hosts was not being observed by browser
# =============================================================================

So, I know this post is way old but, for me in "Firefox Quantum" not being able to use the host file was driving me NUTS, I'm way to OCD for this... lol, so before I canned Firefox, I Ran/Fell down the rabbit hole

After scouring thru the web looking for answers, reading blogs forums and potential answers everywhere, yet, still getting nowhere:

I had tried:

  1. Reformatting my /etc/hosts file

    • Just incase this contained hidden characters
    • Also, Tested host file formatting using:
      • 1 space
      • 4 spaces
      • 1 tab
      • This made no difference to Chrome, Safari or Firefox
  2. Also, Tried modifying Firefox's about:config Changed

    • browser.fixup.dns_first_for_single_words to True
    • network.dns.disablePrefetch to True
    • network.dns.offline-localhost to False
    • network.dnsCacheEntries to 0 (ZERO)
    • network.dnsCacheExpiration to 0 (ZERO)
    • network.dnsCacheExpirationGracePeriod to 0 (ZERO)

and to no avail (I reverted all the above back to default)

# =============================================================================
# FINALLY, I found that you have to change 3 things
# =============================================================================
  • Navigate to 3 bars > Preferences > General > Scroll to the end > Network Proxy > settings
  • Configure Proxies to Access the Internet: *CHANGE* Auto-detect proxy settings for this network

    • I was using Use System Proxy Settings

      1. I also found that is you change tracking in preferences & config this hides the box's too in Firefox
  • Navigate to 3 bars > Preferences > Privacy & Security > Tracking Protection >Always& "Do Not Track" >Always AND YOU ALSO have to set this in the browserabout:config`
  • privacy.trackingprotection.enabled To True

This hides the error'd out ad's instead of showing the iframe with the blocked content.

I'm so happy right now that I got this workin' I hope this helps someone!

You must log in to answer this question.