Fiddler做代理服务器时添加X-Forwarder-For转发真实客户端ip

修改CustomRules.js

菜单: Rules->Customize Rules (ctrl+R)

 

在 static function OnBeforeRequest(oSession: Session) 中添加如下js:

var clientIp=oSession["X-CLIENTIP"];
var reg=/([0-9]+.)+/ig;
clientIp=clientIp.match(reg);
oSession.oRequest["X-Forwarder-For"]=clientIp;

 

 

 

上述改动会对所有的代理请求都添加x-forwarder-for,下面增加了一个判断,只对特定域名的请求增加x-forwarder-for(也可以命名为其它任何自定义名称)

 

 

posted @ 2017-05-10 17:42  yaks  阅读(2160)  评论(0编辑  收藏  举报