This is a migrated thread and some comments may be shown as answers.

Dynamic changing Fiddler "GateWay/Proxy Configuration" base on some rules

2 Answers 581 Views
Extensions and Customization
This is a migrated thread and some comments may be shown as answers.
Jessie
Top achievements
Rank 1
Jessie asked on 28 May 2020, 09:48 AM

Hey,

In fiddler Option-Gateway, we can configure "Manual Proxy Configuration" which fiddler will redirect the traffict to,

I need to create an extension to specify different gateway proxy for different host name, could anyone give me any lead?

For instance, in the extension, If the request host is google.com, I will set Proxy as 192.168.0.1:8000,

if request host is yahoo.com, I will set set Proxy as 192.168.0.1:8001 ...

I can't find any api change the proxy, any help will be appreciated.

Best wishes,

Jessie

2 Answers, 1 is accepted

Sort by
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 02 Jun 2020, 12:34 AM

Hi Jessie,

The Gateway Options require Fiddler to be restarted which indicates that Fiddler sets these options at startup and can't be changed at runtime.

However, an extension that listens for and modifies each Web Request might work in this scenario. This is depending on the exact requirements.

In this case, it would need to implement the IAutoTamper Interface and use the AutoTamperRequestBefore Handler to point the URL to the Upstream Proxy. See the below code snippet for an example. 

class UpstreamByHostname : IAutoTamper
{
    // Code Removed for Brevity

    public void AutoTamperRequestBefore(Session oSession)
    {
        if (oSession.HostnameIs("www.yahoo.com"))
        {
            oSession.url = "192.168.0.1:8001";
        }
        else if (oSession.HostnameIs("www.google.com"))
        {
            oSession.url = "192.168.0.1:8000";
        }
    }

    // Code Removed for Brevity
}

Note that the previous example shows how to retarget a request and might not meet your exact needs.

Although, once the Session is available in the IAutoTamper Implementation, all of the same Modifying a Request or Response options would work.

Please let me know if this points you in the right direction or if you have any additional questions. Thank you for using the Fiddler forums.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jessie
Top achievements
Rank 1
answered on 02 Jun 2020, 12:43 AM

Hey Eric,

Thanks for your help, yes I did checked the Fiddler api, and realized it seems not possible to dynamic assign a proxy for each request, so I coded a https proxy already , which solved my issue.

 

Thanks anyway,

Jessie

Tags
Extensions and Customization
Asked by
Jessie
Top achievements
Rank 1
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
Jessie
Top achievements
Rank 1
Share this question
or