IT:AD:Internet Explorer:Issues:Host File not getting Read
Situation
- You've created a website on your local machine, created an entry in your hosts file mapping it to 127.0.0.1, and from the cmd line, pinged the url, getting back what you would expect. But when you navigate to it with a browser, it fails.
Solution
The issue is that a browser uses a different proxy solution than the command line.
In an enterprise environment, the command line gets its DNS info from hooking up to the DNS of the Domain Controller. A browser on the other hand…it depends.
If Detect Settings Automatically is set, it uses WPAD (Web Proxy Automatic Discovery)…which can be totally different.
Turn it off, and it starts behaving like your Command line again.
But if you need to set the Proxy directly, it uses the Proxy's DNS, and again ignores your entries in the local hosts file…
The solution is to click Advanced, and set there the path that matches what is in hosts. The logic is that for all things not excluded in Advanced, it uses the proxy. For the excluded one, it drops to looking at the local hosts file.
Remarkably (one gets suspicious after a while of this rigamorol that it's all going to be difficult), the Advanced exclusion list accepts '' as a wilcard…so one can come up with naming strategy…eg '.localhost' for local sites.
Another surprising find: according to the reference below, hosts file are case sensitive. Who knew…Although I just checked on Win7, and that did not appear to be the case – worked fine either way.
Observed: whether you ignore local urls or not doesn't appear to change the end result – at least in terms of the hosts file (although it will continue to work as expected (ie bypass) records found via the DNS).