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

时间:2023-03-08 17:35:03

修改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;

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

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

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