27
6
I'm using OS X 10.8.5 and Chrome 30.
I added 127.0.0.1 youtube.com
to my /etc/hosts
file such that it now contains this:
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 youtube.com
When I run the command traceroute youtube.com
I receive the expected results (youtube.com is resolved to 127.0.0.1):
traceroute to youtube.com (127.0.0.1), 64 hops max, 52 byte packets
1 localhost (127.0.0.1) 0.272 ms 0.118 ms 0.063 ms
However, when I type youtube.com in Chrome, my browser doesn't establish a connection with 127.0.0.1 but instead with the "normal" IP address for YouTube. I would have expected Chrome to resolve youtube.com to 127.0.0.1.
I have Chrome configured to use my system's proxy settings. In OS X, when I go to System Preferences > Network > "Advanced..." > Proxies, I have selected "Auto Proxy Discovery".
Why is Chrome seemingly ignoring my /etc/hosts
file?
2
Possible duplicate of Why is Chromium bypassing /etc/hosts and dnsmasq?
– Scott – 2018-04-12T06:37:43.670you are probably using a VPN or a chrome extension that ALTERS your connection in someway – user1735921 – 2019-12-16T08:40:12.903
4Are you certain it's trying to resolve youtube.com and not www.youtube.com? It could also be that youtube.com has a 301 redirect which is cached by the browser so that it does not even attempt to contact youtube.com (not on my computer to check). – user2313067 – 2013-09-20T17:47:00.327
@user2313067 Thank you! I revised /etc/hosts to also have a line for www.youtube.com resolving to 127.0.0.1 and that did the trick. – Jonathan – 2013-09-20T18:48:57.710
@user2313067 You may want to post your comment as an answer. – Blacklight Shining – 2013-09-21T03:27:06.293