fiddler:如何禁用覆盖标题主机 [英] fiddler: how to disable overwrite Header Host
问题描述
使用Fiddler时,会弹出警告对话框。
When using Fiddler, it pops up an alert dialog.
Fiddler has detected a protocol violation in session #14.
The Request's Host header did not match the URL's host component.
URL Host: proxy.music.pp.com
Header Host: 119.147.22.41
并且它显示Fiddler将HTTP Header的主机更改为proxy.music.pp.com,有没有办法禁用Fiddler更改它?
And it shows that Fiddler changed HTTP Header's host to "proxy.music.pp.com", is there any way to disable Fiddler changing it?
推荐答案
从我的书籍:
交换主机标头
当Fiddler收到其URL与其主机标头不匹配的请求时,原始主机值存储在会话标志 X-Original-Host
中,然后将主机
值替换为解析的主机来自URL。放置在FiddlerScript的 BeforeRequest
函数中的以下脚本通过将请求路由到原始主机头指定的主机来反转行为。
When Fiddler gets a request whose URL doesn’t match its Host header, the original Host value is stored in the session flag X-Original-Host
and then the Host
value is replaced with the host parsed from the URL. The following script, placed inside your FiddlerScript's BeforeRequest
function, reverses behavior by routing the request to the host specified by the original Host header.
if (oSession.BitFlags & SessionFlags.ProtocolViolationInRequest)
{
var sOverride = oSession["X-Original-Host"];
if (!String.IsNullOrEmpty(sOverride))
{
oSession["X-overrideHost"] = sOverride;
oSession["ui-backcolor"] = "yellow";
// Be sure to bypass the gateway, otherwise overrideHost doesn't work
oSession.bypassGateway = true;
}
}
这篇关于fiddler:如何禁用覆盖标题主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!