Windows – Using Proxy Server to act as hosts file


I am trying to see if I can have a specific Hosts file that only a Proxy Server application on my machine will use while the remainder of the machine uses the normal proxy server.

For example, I want to take (and this is JUST AN EXAMPLE) and map it to However, I only want this to happen when connected to a proxy server application running on my machine.

Then I would configure Firefox to use the Proxy Server while IE doesn't use the Proxy server.

Could I use something like Fiddler, Charles, or some other Proxy/Debugger and have only that application use a custom Hosts file?

Why? This allows me to compare the live web site with what I have developed locally. Trust me, I need the host name mapping for a reason. I'm using HTML from the live site with local CSS changes. I need to compare those CSS changes to what is in Production environment.

Best Answer

Fiddler can do this. Using custom rules in it's CustomRules.js file, you can simulate the Windows hosts file by pointing one hostname to a different IP address. An example is provided on their script samples page:

// All requests for should be directed to the development server at
if (oSession.HostNameIs(""))
oSession.bypassGateway = true;  // Prevent this request from going through an upstream proxy
oSession["x-overrideHost"] = "";  // DNS name or IP address of target server
Related Question