question

MariuszKlimek avatar image
0 Votes"
MariuszKlimek asked ·

Why is Azure API Management hides response body for status codes 4** and 5**

I created an API in Azure API Management and I realized that APIM actually hides some of the bodies I return.

I get 200, but I don't get 404, 401 and 500.

I understand that it's better to control what is returned and that we don't want to give the end-user HTML with 500 error body.

I use 404 or 401 in my API along with returning messages to the user. Is there a possibility to control what is being returned for certain status codes?

azure-api-management
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MikeUrnun avatar image
0 Votes"
MikeUrnun answered ·

Hi @MariuszKlimek

You'll need to add an on-error policy and use it in conjunction with the set-body policy to ensure the response body coming from your API is carried over to the response that the caller receives. In order to implement it, please review the following:

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MariuszKlimek Just following up here on my answer above, let us know if there are any further questions and we'd be happy to assist.

0 Votes 0 ·