gpt4 book ai didi

fiddler - 使用 Fiddler 作为反向代理

转载 作者:行者123 更新时间:2023-12-04 11:12:39 26 4
gpt4 key购买 nike

Fiddler 指定了两个选项将其用作反向代理。

选项1:

Fiddler can be configured so that any traffic sent to http://127.0.0.1:8888 is automatically sent to a different port on the same machine. To set this configuration:

Start REGEDIT

Create a new DWORD named ReverseProxyForPort inside HKCU\SOFTWARE\Microsoft\Fiddler2.

Set the DWORD to the local port you'd like to re-route inbound traffic to (generally port 80 for a standard HTTP server)

Restart Fiddler

Navigate your browser to http://127.0.0.1:8888



选项 2:

Alternatively, you can write a rule that does the same thing.

Say you're running a website on port 80 of a machine named WEBSERVER. You're connecting to the >website using Internet Explorer Mobile Edition on a Windows SmartPhone device for which you cannot >configure the web proxy. You want to capture the traffic from the phone and the server's response.

Start Fiddler on the WEBSERVER machine, running on the default port of 8888.

Click Tools | Fiddler Options, and ensure the "Allow remote clients to connect" checkbox is checked. Restart if needed.

Choose Rules | Customize Rules.

Inside the OnBeforeRequest handler, add a new line of code: if (oSession.host.toLowerCase() == "webserver:8888") oSession.host = "webserver:80";

On the SmartPhone, navigate to http://webserver:8888



这两个选项都涉及在同一台机器上使用 Fiddler,但是如果 Fiddler 和 Web 服务器在两台不同的机器上运行怎么办?例如,假设某个用户查询 example.com 并解析为 1.2.3.4。我可以在 1.2.3.4 上运行 Fiddler 以在查询 example.com 时将流量转发到 1.2.3.5 吗?假设我使用选项 2 来配置 Fiddler,我是否会将“webserver”设置为 example、example.com、www.example.com 或 example.com 的 IP 地址(假设 www.example.com 是 example.com 的别名) )?

最佳答案

if (oSession.HostNameIs("subdomain.example.com")) {
oSession.bypassGateway = true; // Prevent this request from going through an upstream proxy
oSession["x-overrideHost"] = "128.123.133.123"; // DNS name or IP address of target server
}

通过将一个主机名指向不同的 IP 地址来模拟 Windows HOSTS 文件

关于fiddler - 使用 Fiddler 作为反向代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9831044/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com