将 Windows 进程重定向到新 URL

发布于 2024-09-29 20:17:03 字数 715 浏览 2 评论 0原文

如何重定向程序以连接到不同的 URL。

我看了这篇文章: 是否可以使用网络代理(例如 fiddler)将 url 重定向到另一个

我在计算机上安装了 fiddler 并将此代码放入 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); 

我需要这样做,所以我可以在测试网址测试我们的新服务器服务,并确保客户端软件仍然可以正常交互。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疏忽 2024-10-06 20:17:03

我知道怎么做了。 :) 我想阅读 Fiddler 文档会有所帮助。

我添加

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文