Layer7 API Management

Expand all | Collapse all

Try-Catch for Route Assertion

Jump to Best Answer
  • 1.  Try-Catch for Route Assertion

    Posted 02-13-2018 04:37 PM

    I want to develop a policy that does the following:

    • Make HTTP GET to URL using Route Assertion
      • If Request is not an HTTP 200 Success response
        • Send Email Alert
      • Else
        • Return content to client

     

    I'm able to return content to the client but I'm wondering how I can have the policy send an email alert in the case that the request is not successful. 



  • 2.  Re: Try-Catch for Route Assertion
    Best Answer

    Posted 02-13-2018 05:28 PM

    Dear mrutherford ,

    One of the error handling structure can be as below,

     

    At least folder

    \_ All folder (for processing flow)

    |_ All folder (for error handling)

     

    The 2nd All folder will be executed if any assertion in 1st All folder fail. If 1st All folder is successful, the 2nd All folder will be skipped and continue the next block.

     

    For your case, put route via http assertion under 1st All folder, and put send email alert assertion under 2nd All folder.

     

    There is other way for error handling, such as using custom error response assertion.

     

    Regards,

    Mark



  • 3.  Re: Try-Catch for Route Assertion

    Posted 03-16-2018 01:14 PM

    Thanks Mark, this did the trick.

     

    However, since I'm using the Require Integrated Windows Authentication Credentials assertion in this policy, I had to move that assertion before the At least Folder. I assume this is because the assertion does an initial fail back to the client to request them to supply credentials using the Negotiate scheme? Otherwise, it would always hit my All Folder for error handling. 



  • 4.  Re: Try-Catch for Route Assertion

    Posted 03-16-2018 01:15 PM

    Sorry, thank you Zhijun*