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) www.cnn.com and map it to 127.0.0.1. 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.

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

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 subdomain.example.com should be directed to the development server at 128.123.133.123
if (oSession.HostNameIs("subdomain.example.com"))
{
oSession.bypassGateway = true;  // Prevent this request from going through an upstream proxy
oSession["x-overrideHost"] = "128.123.133.123";  // DNS name or IP address of target server
}
link|improve this answer
1  
Latest version of Fiddler 2.2.7.5 has a HOSTS mapping feature under TOOLS -> HOSTS that does exactly this same thing. I was originally using an older version that did not have the feature. Also, Charles Proxy has the same feature called "DNS Spoofing". – nopuck4you Jan 8 '10 at 17:38
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.