I have multiple conditional flows based in the proxy path suffix.
Example
/cats
/dogs
/elephants
I want to Raise Fault of 404 resource not found if none of them are matched.
How can I achieve this?
@dchiesa1
Please advise.
Solved! Go to Solution.
My standard practice is to have a "default" conditional flow that has no condition. It will execute if none of the other conditions match. Like this
<Flows>
<Flow name="flow1">
<Request>
<Step>...</Step>
<Step>...</Step>
<Step>...</Step>
</Request>
<Response>
<Step>...</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/t1") and (request.verb = "POST")</Condition>
</Flow>
<!-- other conditional flows here -->
<!-- each should have a non-empty Condition element -->
<Flow name="unknown request">
<!-- no Condition. This flow gets executed if none of the above match -->
<Request>
<Step>
<Name>RF-Unknown-Request</Name>
</Step>
</Request>
<Response>
</Response>
</Flow>
</Flows>
My standard practice is to have a "default" conditional flow that has no condition. It will execute if none of the other conditions match. Like this
<Flows>
<Flow name="flow1">
<Request>
<Step>...</Step>
<Step>...</Step>
<Step>...</Step>
</Request>
<Response>
<Step>...</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/t1") and (request.verb = "POST")</Condition>
</Flow>
<!-- other conditional flows here -->
<!-- each should have a non-empty Condition element -->
<Flow name="unknown request">
<!-- no Condition. This flow gets executed if none of the above match -->
<Request>
<Step>
<Name>RF-Unknown-Request</Name>
</Step>
</Request>
<Response>
</Response>
</Flow>
</Flows>
Use Raise Fault policy in Pre-flow with the condition:
<Condition>proxy.pathsuffix is Null || (!(proxy.pathsuffix MatchesPath "/cats") AND !(proxy.pathsuffix MatchesPath "/dogs") AND !(proxy.pathsuffix MatchesPath "/elephants"))</Condition>
<Name>RF-UnknownResource</Name>
Yes, this is a different way to do things. Keep in mind that in this case you're checking only the pathsuffix, and not the verb.