Jaa


hosts file gets ignored by browser when behind proxy server

This issue took a long time for me to workaround. My browser works inside a corpnet proxy server. In a brand new Win8 machine, I setup hosts file under %systemroot%\system32\drivers\etc to redirect a site to localhost. But it didn't work in IE and other browsers. We thought it could be problem with which domain the machine is joined to. Changing the domain also didn't help. Looking at various sites in web search also didn't help. 

Based on tips from various site, here is a workaround that works for me.

- Go to internet options, connections tab, click lan settings.
- click on proxy server, check "User a proxy server" and give proxy server details
- click on advanced button, under exceptions add the site to be redirected
- Make sure to enter the full site address, for example https://joyofprogramming.com not just joyofprogramming.com

Basically the browser looks at proxy server before looking into hosts file. Adding the exceptions above seem to help it.

Any better way to solve it? Will look forward in comments.

Comments

  • Anonymous
    April 01, 2014
    that can work when u have one/two/three hosts to bloc/redirect. When my hosts list size is 7to8 Mib then how can that be used? I am also searching a solution for that!!