How to automatically re-enable Fiddle as system proxy?

4 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
    832 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
    66 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);
    }

  4. mark
    mark avatar
    1 posts
    Member since:
    Mar 2017

    Posted 24 Mar Link to this post

    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?
Back to Top