2010-10-28 115 views
0

如何重定向程序以連接到其他URL。將窗口重定向到新URL

我看了這個帖子:Is it possible to redirect a url to another using a webproxy (such as fiddler)

我的機器上安裝fidller,並把這個代碼在自定義規則中onBeforeResponse方法

  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); 

我需要這樣做,所以我可以測試我們在測試網址上提供新的服務器服務,並確保客戶端軟件仍能正常交互。

回答

0

我發現如何去做。 :)我想這有助於閱讀提琴手文檔。

我加

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"; 

OnBeforeRequest

,我發現這個在http://www.fiddler2.com/fiddler/dev/scriptsamples.asp