How to automatically re-enable Fiddle as system proxy?

3 posts, 0 answers
  1. nasekt
    nasekt avatar
    40 posts
    Member since:
    Aug 2014

    Posted 02 Apr 2015 Link to this post

    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.
  2. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 02 Apr 2015 Link to this post

    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.

     
  3. EricLaw
    EricLaw avatar
    67 posts
    Member since:
    Oct 2012

    Posted 30 Sep 2015 in reply to Eric Lawrence Link to this post

    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);
    }

Back to Top