Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Response flow in case of non-success response code, is not going in pre-defined manner

Not applicable

I have a proxy in which, if the response from the backend is 200, then everything works as expected. I have some policies attached to the response flows.

If I get a non success response code from backend(404), then it is not going through those flows and showing the response coming from backend. I need to customize the response in all cases. Can someone tell me how?

Solved Solved
0 8 6,422
1 ACCEPTED SOLUTION

Dear @Arun Kumar Reddy ,

The behavior is as designed. When the response code received from the backend is not a success (2xx, 3xx), the flow within Apigee will go into error flow. By default, Apigee Edge treats HTTP code 4XX or 5XX as errors, and it treats HTTP code 1XX, 2XX, 3XX as success. Find more information here.

You can use the success.codes property to configure the TargetEndpoint to treat HTTP response codes 400 and 500 as a success, along with the default HTTP codes. By treating those codes as a success, the TargetEndpoint takes over the processing of the response message, instead of invoking the Error flow.

<TargetEndpoint name="default">
  <HTTPTargetConnection>
    <Properties>
	  <Property name="success.codes">1xx,2xx,3xx,400,500</Property>
    </Properties>
    <URL>http://weather.yahooapis.com</URL>
  </HTTPTargetConnection>
</TargetEndpoint>

View solution in original post

8 REPLIES 8