For all errors other than policy errors, and for policy errors where the continueOnError element is “false”, an API proxy immediately enters the Error flow. Once the API proxy enters the Error flow, it cannot return processing back to the normal flow pipeline.
Edge now supports the PostClientFlow in the response flow, which executes after the response is returned to the requesting client app. Only MessageLogging policies can be attached to this flow, which are executed after the response is sent.
The PostClientFlow is special in two ways:
- It only executed as part of the response flow.
- It is the only flow executed after the proxy enters the Error flow.
Because it is executed regardless of whether the proxy succeeded or failed, you can put MessageLogging policies in the PostClientFlow and be guaranteed that they always execute.
The following Trace image shows a MessageLogging policy executing as part of the PostClientFlow, after the default fault rule executes:
In this example, the VerifyAPIKey policy caused the fault because of an invalid key.
Shown below is the ProxyEndpoint definition that incudes the PostClientFlow:
<ProxyEndpoint name="default">
...
<PostClientFlow>
<Response>
<Step>
<Name>Message-Logging-1</Name>
</Step>
</Response>
</PostClientFlow>
...
</ProxyEndpoint>
