使用fiddler對瀏覽器中的網站進行抓包時可能會出現跨域問題導致抓包失敗。

解決方法:
1.從工具欄菜單的 Rules->Customize Rules 進入。

2.使指定URL支持CORS跨域請求。
支持 CORS 跨域,就是要為請求的返回頭增加 Access-Control-Allow-Origin 屬性,因此需要修改 OnBeforeResponse函數,在該函數的末尾添加 CORS 邏輯, 代碼:
static function OnBeforeResponse(oSession: Session) { ... if(oSession.uriContains("要處理的url")){ oSession.oResponse["Access-Control-Allow-Origin"] = "允許的域名"; oSession.oResponse["Access-Control-Allow-Credentials"] = true; } }
3.在autoresponder 中勾選“enable rules”和“unmatched requests passthrough” 后,添加上相應的域名。

完成以上操作就可以抓包成功了。
