You should have an Apigee policy that handles errors returned by the target server.

If you don't configure error handling using a policy, the API proxy goes into an error state in the <TargetEndpoint> response, and the normal API proxy flow won't continue to the <ProxyEndpoint>.

  1. Go to API Proxies > httpbin_bad_response > Develop and create a new ReturnGenericError policy of type AssignMessage. Configure the policy as desired.
    Screen capture of the ReturnGenericError policy creation within Apigee
  2. Select the PreFlow option in the Target Endpoints for your API proxy. Add the error policy you just created as a <Step> in the <DefaultFaultRule>.
    Note:

    There are multiple methods for adding the error handling policy.

    Screen capture of adding the ReturnGenericError policy as a step within the DefaultFaultRule for the API proxy in Apigee