fiddler 設定代理跳轉
阿新 • • 發佈:2020-12-09
預設埠是 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 }
在模擬重新請求就好了