We have APIs which have customer fault policies to fire if there's a key validation failure, custom errors thrown from javascript, etc but we would like to have a message logging policy fire as well, Of course, once a custom policy fires, a default rule won't fire, even with "AlwaysEnforce".
Are there any ways to get around this without completely tearing apart our proxy flow and moving the RaiseFault policies out of the fault rules and into the proxy/target flows?
Hi @Sean Case . It's good to see you posting on the community!
Did you try leveraging PostClientFlow? http://apigee.com/docs/api-services/reference/api-proxy-configuration-reference#flows
Let us know post your findings. Cheers!
@Diego Zuluaga will a post client flow be reached if a fault is raised? Ive asked about this before and am not clear that it will once a fault policy is called.
Just to verify, I tried putting the message logging policy in the post flow and it was skipped when the fault rule fired.
Maybe I'm missing something from your scenario, but I've just tried a simple example and AlwaysEnforce seems to work fine regardless another FaultRule was executed. Take a look at the snapshot below.
Attached API Proxy bundle in case you want to execute it.
stupid question - how do i download the package?
<AlwaysEnforce>
element in the <DefaultFaultRule>
tag is true.
I think what we might need to do is attach the message logging policy to each and every one of the fault rules as the first item (before the raisefault policies and without a condition) so that it fires before getting to the specified raisefault policy.
I'm attaching an edited version of your proxy which is similar to our situation (except our API has most of the fault rules being fired within the proxy request flows).
Thanks, Diego!
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |