Question

How do I redirect a program to connect to a different URL.

I looked at this post: Is it possible to redirect a url to another using a webproxy ( such as fiddler )

I installed fidller on the machine and put this code in the custom rules in the onBeforeResponse method

            oSession.utilDecodeResponse();
var oBody =System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes);

// Replace all instances of the DIV tag with an empty string
var oRegEx = "myoldurl.com";
oBody = oBody.replace(oRegEx, "testingurl.com");

       // Set the response body to the div-less string
     oSession.utilSetResponseBody(oBody); 

I need to do this so I can test our new server service at a testing url and make sure the client software still interacts appropriately.

Was it helpful?

Solution

I found out how to do it. :) I guess it helps to read the Fiddler Documentation.

I added

if (oSession.HTTPMethodIs("CONNECT") && (oSession.PathAndQuery == "www.example.com:443")) { 
    oSession.PathAndQuery = "beta.example.com:443"; 
}

if (oSession.HostnameIs("www.example.com")) oSession.hostname = "beta.example.com";  

to the OnBeforeRequest

I found this at http://www.fiddler2.com/fiddler/dev/scriptsamples.asp

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top