Seeing a 502 Bad Gateway Response instead of HTTP 504

I am seeing a HTTP 502 Bad gateway on the client side when I see Apigee trace showing HTTP 504. As explained in the docs the message processor shows the Gateway Timeout Error

2019-02-04 17:50:18,701 org:xxxxxx env:dev api:DPNOrderRequest rev:2 messageid:np-rmp-n05-rh-87273-83596-29  NIOThread@3 ERROR HTTP.CLIENT - HTTPClient$Context$3.onTimeout() :  SSLClientChannel[Connected: Remote:13.66.247.85:443 Local:10.162.0.7:40508]@80252 useCount=1 bytesRead=0 bytesWritten=178649 age=55025ms  lastIO=55012ms  isOpen=true.onTimeoutRead2019-02-04 17:50:18,701 org:xxxxxx env:dev api:DPNOrderRequest rev:2 messageid:np-rmp-n05-rh-87273-83596-29  NIOThread@3 ERROR ADAPTORS.HTTP.FLOW - AbstractResponseListener.onException() : AbstractResponseListener.onError(HTTPResponse@57623318, Gateway Timeout)

I did identify the rootcause that the backend is not responding within 55 seconds. Its taking around 66 seconds to give the response.

I have no io.timeout value configured in the API proxy, so the default values are being used.

The only issue is the client is seeing HTTP response code 502, why is it not 504? Am I missing anything that needs to be configured in the router properties to send http 504 back to client?

0 1 896
1 REPLY 1

I figured out that we have a gateway that receives the request from the client and then routes to Apigee. This gateway had a request timeout configuration of 30 seconds and was giving HTTP 502 Bad Gateway error. That's the reason the client was seeing HTTP 502, though Apigee was giving a HTTP 504 after 55 seconds.