Search code examples
fiddler

Abort request in Fiddler script automatically


It is possible to run a script on prerequest and preresponse in Fiddler script. I want to automatically abort requests that contain a string in the URL.

In the Fiddler GUI it is possible to abort the request by right clicking the request and then clicking abort but I want to do this automatically.

In Fiddler script in the onbeforerequet method I have added

 if (oSession.uriContains("string")) {  
      //abort request   
  }

This is true when my string is contained in the URL. How can I abort the request?


Solution

  • oSession.oRequest.FailSession(404, "Blocked", "Fiddler blocked request");
    

    Should do the deal.