fiddler 设置代理跳转

默认端口是 8888

模拟器或者 APP 设置好 代理地址后,

在fiddler 上进行配置  rules--->customer rules.   里的OnBeforeRequest方法末尾加上

 

复制代码
 1 static function OnBeforeRequest(oSession: Session) {
 2         // Sample Rule: Color ASPX requests in RED
 3         // if (oSession.uriContains(".aspx")) {    oSession["ui-color"] = "red";    }
 4 
 5         // Sample Rule: Flag POSTs to fiddler2.com in italics
 6         // if (oSession.HostnameIs("www.fiddler2.com") && oSession.HTTPMethodIs("POST")) {    oSession["ui-italic"] = "yup";    }
 7 
 8         // Sample Rule: Break requests for URLs containing "/sandbox/"
 9         // if (oSession.uriContains("/sandbox/")) {
10         //     oSession.oFlags["x-breakrequest"] = "yup";    // Existence of the x-breakrequest flag creates a breakpoint; the "yup" value is unimportant.
11         // }
12 
13         if ((null != gs_ReplaceToken) && (oSession.url.indexOf(gs_ReplaceToken)>-1)) {   // Case sensitive
14             oSession.url = oSession.url.Replace(gs_ReplaceToken, gs_ReplaceTokenWith); 
15         }
16         if ((null != gs_OverridenHost) && (oSession.host.toLowerCase() == gs_OverridenHost)) {
17             oSession["x-overridehost"] = gs_OverrideHostWith; 
18         }
19 
20         if ((null!=bpRequestURI) && oSession.uriContains(bpRequestURI)) {
21             oSession["x-breakrequest"]="uri";
22         }
23 
24         if ((null!=bpMethod) && (oSession.HTTPMethodIs(bpMethod))) {
25             oSession["x-breakrequest"]="method";
26         }
27 
28         if ((null!=uiBoldURI) && oSession.uriContains(uiBoldURI)) {
29             oSession["ui-bold"]="QuickExec";
30         }
31 
32         if (m_SimulateModem) {
33             // Delay sends by 300ms per KB uploaded.
34             oSession["request-trickle-delay"] = "300"; 
35             // Delay receives by 150ms per KB downloaded.
36             oSession["response-trickle-delay"] = "150"; 
37         }
38 
39         if (m_DisableCaching) {
40             oSession.oRequest.headers.Remove("If-None-Match");
41             oSession.oRequest.headers.Remove("If-Modified-Since");
42             oSession.oRequest["Pragma"] = "no-cache";
43         }
44 
45         // User-Agent Overrides
46         if (null != sUA) {
47             oSession.oRequest["User-Agent"] = sUA; 
48         }
49 
50         if (m_Japanese) {
51             oSession.oRequest["Accept-Language"] = "ja";
52         }
53 
54         if (m_AutoAuth) {
55             // Automatically respond to any authentication challenges using the 
56             // current Fiddler user's credentials. You can change (default)
57             // to a domain\\username:password string if preferred.
58             //
59             // WARNING: This setting poses a security risk if remote 
60             // connections are permitted!
61             oSession["X-AutoAuth"] = "(default)";
62         }
63 
64         if (m_AlwaysFresh && (oSession.oRequest.headers.Exists("If-Modified-Since") || oSession.oRequest.headers.Exists("If-None-Match")))
65         {
66             oSession.utilCreateResponseAndBypassServer();
67             oSession.responseCode = 304;
68             oSession["ui-backcolor"] = "Lavender";
69         }
70         
71         // TODO 
72 if (oSession.uriContains("xxx.xx.xx.xx:7821")) {
73             oSession.host="172.29.212.66:9110";
74         }
75         
76     }
复制代码

在模拟重新请求就好了

 

posted @   jk_tim  阅读(472)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示