From my book:
Swap the Host Header
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;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…