I've got an Azure Functions Proxy set up that calls an underlying API. This is working fine, but there seems to be some inconsistent behaviour when it comes to passing errors from the API.
When trying to get a resource that doesn't exist the API returns a 404 response with a friendly error message. This gets passed through the proxy as well, so the caller gets to see that message.
When a server error happens the API returns a 500 response with a friendly error message, but in this case that response does not get passed through the proxy and instead it returns a generic XML error:
<ApiErrorModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Azure.WebJobs.Script.WebHost.Models">
<Arguments xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
<ErrorCode>0</ErrorCode>
<ErrorDetails i:nil="true" />
<Id>edf8c2a7-cb2e-45a0-b2c7-f5ef849c9f50</Id>
<Message>An error has occurred. For more information, please check the logs for error ID edf8c2a7-cb2e-45a0-b2c7-f5ef849c9f50</Message>
<RequestId i:nil="true" />
<StatusCode>InternalServerError</StatusCode>
</ApiErrorModel>
Is there a way to get the proxy to pass through any error messages it receives from the API back to the calling client?