How to configure a apigee proxy to handle a 205 Response Code

Hi Team, @dchiesa1 

We have an api proxy where a post request is generating a target response code 205 with a payload. When we recieve the response in the apigee proxy we get the following  error and I don't see that we have access to the payload in order to mediate it. Is there additional configuration we can add to the proxy to handle these operations?

Error Headers
Content-Type application/json
Error Content
Body
{"fault":{"faultstring":"Received 205 Response with message body","detail":{"errorcode":"protocol.http.ResponseWithBody"}}}

When the user hits the end point directly they get a customized json response with several attributes.

We are losing this info currently and are unable to return it.

Thanks for your help.

Mark

Solved Solved
0 1 201
1 ACCEPTED SOLUTION

I understand the situation and your request.

This has come up before. Apigee is complaining about a protocol violation by the target. The standard says that a server that returns 205 must not return content.

rfc-9110-status-205.png

Apigee is strict about this.The Apigee runtime considers a 205 status with a content body to be a protocol violation, and as with all of those, Apigee stops the connection and throws a fault. 

You can use Fault Rules to handle errors that occur in your API Proxy, including this one. I think the fault.name you want to key on in the Condition is "ResponseWithBody".

But I have further suggestions.

  • Fix the server so that it does not return a body with the 205 status.  That will comply with the spec, and will eliminate the need for you to "handle faults" within your API proxy.  
  • Consider whether you need to use 205 in an API at all.  What does 205 mean, in the context of an API request?  It's intended to be used to allow a server to tell a client to clear its web form.  It feels weird to use a 205 status for an API call. There is no form. 

View solution in original post

1 REPLY 1

I understand the situation and your request.

This has come up before. Apigee is complaining about a protocol violation by the target. The standard says that a server that returns 205 must not return content.

rfc-9110-status-205.png

Apigee is strict about this.The Apigee runtime considers a 205 status with a content body to be a protocol violation, and as with all of those, Apigee stops the connection and throws a fault. 

You can use Fault Rules to handle errors that occur in your API Proxy, including this one. I think the fault.name you want to key on in the Condition is "ResponseWithBody".

But I have further suggestions.

  • Fix the server so that it does not return a body with the 205 status.  That will comply with the spec, and will eliminate the need for you to "handle faults" within your API proxy.  
  • Consider whether you need to use 205 in an API at all.  What does 205 mean, in the context of an API request?  It's intended to be used to allow a server to tell a client to clear its web form.  It feels weird to use a 205 status for an API call. There is no form.