Attaching policies for backend errors

Not applicable

I have some policies that add informational headers to the response after it comes back from the backend (QuotaLimit information and CORS).

But if the backend sends an error, such as a 404, those policies don't seem to be executed. They don't show up in Trace at all—I can't tell that it's even going through the Response flows when there's a backend error.

How do I ensure these errors are being attached even when there's an 4XX 5XX status code?

Solved Solved
0 1 305
1 ACCEPTED SOLUTION

Not applicable

In your proxy definition you need to add DefaultFaultRules.

These will execute whenever a normal flow is interrupted. Here is an example:

    <DefaultFaultRule name="fault-handler">
        <Step>
            <Name>assignCORSHeaders</Name>
        </Step>
        <Step>
            <Name>assignCustomIDHeader</Name>
        </Step>
        <Step>
            <Name>jsCalloutSplunkLogging</Name>
        </Step>
    </DefaultFaultRule>

These are just sample policies to attach - you can add whatever you need to complete the flow. Conditions are allowed here as well.

Full documentation at: http://apigee.com/docs/api-services/content/fault-handling

View solution in original post

1 REPLY 1

Not applicable

In your proxy definition you need to add DefaultFaultRules.

These will execute whenever a normal flow is interrupted. Here is an example:

    <DefaultFaultRule name="fault-handler">
        <Step>
            <Name>assignCORSHeaders</Name>
        </Step>
        <Step>
            <Name>assignCustomIDHeader</Name>
        </Step>
        <Step>
            <Name>jsCalloutSplunkLogging</Name>
        </Step>
    </DefaultFaultRule>

These are just sample policies to attach - you can add whatever you need to complete the flow. Conditions are allowed here as well.

Full documentation at: http://apigee.com/docs/api-services/content/fault-handling