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

How to automatically re-enable Fiddle as system proxy?

3 Answers 509 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
nasekt
Top achievements
Rank 1
nasekt asked on 02 Apr 2015, 09:28 PM
I am running Fiddler as windows service and when I reset Internet options, Fiddler no longer acts as system proxy. Is there a way for Fiddler to detect changes in  proxy server and re-attach itself as system proxy?

This is what I tried

static function OnDetach() {

if (FiddlerApplication.oProxy.DetachedUnexpectedly)  { 
   FiddlerApplication.oProxy.Attach;

   }

}

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Eric Lawrence
Telerik team
answered on 02 Apr 2015, 09:44 PM
Reattaching Fiddler automatically is perilous for a bunch of reasons, but yes, it's technically possible to observe changes in the proxy setting for the current user and reattach if they change.

In CustomRules, add the following code:

static function DoReattach(o: Object, ea: EventArgs)
{
   ScheduledTasks.ScheduleWork("reattach", 1000, innerReattach);
}

static function innerReattach()
{
   FiddlerApplication.UI.actAttachProxy();
}

static function OnRetire()
{
   FiddlerApplication.oProxy.remove_DetachedUnexpectedly(DoReattach);
}

and inside the existing Main() function, add

  FiddlerApplication.oProxy.add_DetachedUnexpectedly(DoReattach);

Regards,
Eric Lawrence
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
EricLaw
Top achievements
Rank 1
answered on 30 Sep 2015, 08:54 PM

for whatever reason, the code formatting above was broken: 

 

static function DoReattach(o: Object, ea: EventArgs)
{
   ScheduledTasks.ScheduleWork("reattach", 1000, innerReattach);
}

static function innerReattach()
{
   FiddlerApplication.UI.actAttachProxy();
}

static function OnRetire()
{
   FiddlerApplication.oProxy.remove_DetachedUnexpectedly(DoReattach);
}

0
mark
Top achievements
Rank 1
answered on 24 Mar 2017, 05:51 AM
This removes the chain of upstream proxy that fiddler was aware of during the startup. I have a script that changes the ProxyServer value in registry and I managed to get Fiddler auto-reattach with the suggested code after running my script. However, when I verify using some method (e.g., we have a website which would tell us which proxy server we are using), Fiddler is no longer using the new proxy I set using my script, instead it defaults to not using a proxy server at all (direct connection). Any idea how to solve this?
Tags
Fiddler Classic
Asked by
nasekt
Top achievements
Rank 1
Answers by
Eric Lawrence
Telerik team
EricLaw
Top achievements
Rank 1
mark
Top achievements
Rank 1
Share this question
or