Skip to content

Instantly share code, notes, and snippets.

@ericlaw1979
Last active December 19, 2023 16:42
Show Gist options
  • Save ericlaw1979/decab196fe127cd9e548b7f675cf22c9 to your computer and use it in GitHub Desktop.
Save ericlaw1979/decab196fe127cd9e548b7f675cf22c9 to your computer and use it in GitHub Desktop.
Reattach Fiddler as system proxy if unexpectedly detached; see https://feedback.telerik.com/fiddler/1410460-the-system-proxy-was-changed-click-to-reenable-capturing for discussion.
// Click Rules > Customize Rules. Scroll to OnBoot() and inside the function add:
static function OnBoot() {
FiddlerApplication.oProxy.add_DetachedUnexpectedly(DoReattach);
//...
// Just before the OnBoot function, add the following new functions:
static function DoReattach(o: Object, ea: EventArgs) {
FiddlerObject.UI.sbpInfo.Text = "Scheduling automatic reattach at " + new Date();
// Reattach after 1 second; waiting 1 second increases the odds that whatever
// process was messing with the system settings is done doing that.
ScheduledTasks.ScheduleWork("reattach", 1000, innerReattach);
}
static function innerReattach()
{
FiddlerApplication.UI.actAttachProxy();
}
static function OnRetire()
{ // Detach this event handler to avoid memory leaks and duplicate processing.
FiddlerApplication.oProxy.remove_DetachedUnexpectedly(DoReattach);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment