Home » Questions » Computers [ Ask a new question ]

How do I get IE to use my hosts file when using a proxy .pac file?

How do I get IE to use my hosts file when using a proxy .pac file?

I have the following line in C:\WINDOWS\system32\drivers\etc\hosts:

Asked by: Guest | Views: 320
Total answers/comments: 2
bert [Entry]

"What does your network's proxy.pac look like? Do you have access to modify it?

I have a proxy autoconfig in my network. I set a hosts file entry on my XP box like yours, and I was still able to connect to myapp.local in IE8 (sorry, don't have IE7 handy to test).

I'm guessing your proxy autoconfig does something that tries to resolve the hostname (mine does not); and that resolving doesn't use the hosts file thus it fails.

If you can modify the proxy.pac, add the following to the beginning of FindProxyForURL (before any other code)

if(dnsDomainIs(host, "".local"")) { return ""DIRECT""; }

Change 'host' in that line to match the second argument of FindProxyForURL. Hopefully this will prevent the autoconfig script from trying to resolve your .local hostname."
bert [Entry]

"I am unsure about proxy.pac as I have not heard about this, so maybe ignore my answer.

It should be checking your hosts file before anything else, it is possible that a old entry is cached. Close Internet Explorer, Go to a (elevated on Vista/7) command prompt and type

ipconfig /flushdns

and restart IE.

Test it now, if it still does not work because of a proxy file, (again, I have little experience here), try adding it to the exceptions in the proxy list.

As your are pinging the correct IP, I think it is just a cache issue as I have sometimes had the same thing after just adding a entry. A restart for me usually does the trick."