【fiddler】解决本地开发跨域问题
2020-05-04 本文已影响0人
DY_alley
一、监听https请求
找到tools--->options--->进行配置
![](https://img.haomeiwen.com/i12255796/bea198bba30af5d6.png)
二、跨域代理设置
点击Rules--->Customize Rules
![](https://img.haomeiwen.com/i4480561/2c584d705c20e069.jpg)
全局搜索OnBeforeResponse,里面可以配置对某个url实现跨域
![](https://img.haomeiwen.com/i4642829/81cba66e97e1aacc.png)
// 需要添加的代码
/*
if(oSession.uriContains("https://wap.fruitday.com")){
oSession.oResponse["Access-Control-Allow-Origin"] = "http://192.168.1.27:3000";
oSession.oResponse["Access-Control-Allow-Credentials"] = true;
oSession.oResponse["Access-Control-Allow-Headers"] = "accept,content-type, x-requested-with";
}
*/
oSession.oResponse["Access-Control-Allow-Origin"] = '*';
oSession.oResponse["Access-Control-Allow-Credentials"] = true;
保存代码推出即可