proxyfiddlerauto-responder

Fiddler: Creating an AutoResponse rule to map all calls to one host to another host


Example: I want to create one AutoResponse rule that will map all calls to one host to another host, but preserve the urls. Examples

http://hostname1/foo.html -> http://hostname2/foo.html

and

http://hostname1/js/script.js -> http://hostname2/js/script.js

in one rule. For now, I've accomplished this by creating aN AutoResponse rule for every URL my project calls, but I'm sure there must be a way to right one rule using the right wildcards. I looked at http://www.fiddler2.com/Fiddler2/help/AutoResponder.asp, but I couldn't see how to do it. The wild cards all seem to be around the matching and not the action.

Full context: I'm developing on a beta platform and Visual Studio is borked in such away that it is sending all the requests to http://localhost:24575 when my project is actually running on http://localhost:56832


Solution

  • To map from one host to another, don't use AutoResponder. Instead, click Tools > Hosts.

    Alternatively, you can click Rules > Customize Rules, scroll to OnBeforeRequest and write a bit of code:

    if (oSession.HostnameIs("localhost") && (oSession.port == 24575)) oSession.port = 56832;