Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fiddler redirect https to localhost

I have an iPhone app that connects to an HTTPS service in Azure. I want to redirect the iPhone calls via Fiddler to http://localhost:19703 where I am running the same service on my local machine for debugging purposes. I am able to redirect the HTTPS service to another HTTPS service using the following Fiddler script. However, if I use the same script to redirect to localhost:19703, it does not work. Any ideas?

   if (oSession.HTTPMethodIs("CONNECT") && (oSession.PathAndQuery ==  "XXXX.azurewebsites.net:443")) 
    {  
        oSession["OriginalHostname"] = oSession.hostname;
        oSession.PathAndQuery =  "YYYY.azurewebsites.net:443";  
    }

    // If it's an HTTPS tunnel, override the certificate

    if (oSession.HTTPMethodIs("CONNECT") && (null != oSession["OriginalHostname"]))
    {
        oSession["x-overrideCertCN"] = oSession["OriginalHostname"];
        oSession["X-IgnoreCertCNMismatch"] = "Server's hostname may not match what we're expecting...";
    }
    oSession.bypassGateway = true;
like image 255
Eefias Fira Avatar asked Nov 09 '22 18:11

Eefias Fira


1 Answers

Try using this approach:

static function OnBeforeRequest(oSession:Fiddler.Session) {
    ...
    if (oSession.HostnameIs("YYYY.azurewebsites.net")) {
        oSession.host = "127.0.0.1:19703";
    }
    ...
}

Complete description of the issue is here.

like image 163
alexey Avatar answered Nov 15 '22 08:11

alexey