Edge Microgateway is not returning the reason phrase string

Not applicable

Our API endpoint is returning a reason phrase when an error occurs. However, Apigee Edge Microgate is returning the error code only (i.e. 405 Method Not Allowed).

How do I get Edge Micro to return the reason phrase response back to the user?

-Devin

0 14 195
14 REPLIES 14

What version of edgemicro are you using? Do you have any plugins installed that manipulate the response?

I am using edgemicro@2.3.3-beta, and I don't have any plugins installed.

Is your target returning a reason string when it's issuing a 405? EM won't populate an error string for a 405 from a backend.

It's not returning for 404 either.

Can EM be changed to return reason string for all HTTP codes?

Is it a 404 from your backend? or from EM?

None of them are coming from EM. There are being sent from my endpoint.

Ah. So EM will only populate error strings when errors originate from EM itself. Since you have no plugins, and strings aren't sent in the response from the endpoint they won't be there.

There isn't a configuration option for EM to auto-populate them.

Two options:

  • Have your desired strings be included in the content sent from the endpoint.
  • Create a plugin to populate the strings based on the target response status code.

Why not have the EM pass the exact error message that is coming from the tartget endpoint similar to AWS API Gateway?

Is EM not passing back content in the response body for your error responses? Not sure I'm following.

EM shouldn't be altering the response body at all. So anything your target is passing back to EM should be passed back to the client.

-Matt

It looks like a bug on the EM side because it's not returning the exact error response from the target endpoint.


postman-with-em.png

postman-without-em.png

The first image above replace the string with "Method Not Allowed". However, the second image returns the correct error message when calling it directly through our ELB.

Ah. I see. That helps. I'll take a look and make a fix.

Has this issue been fixed and deployed yet?

Hi devingrant,

This will be deployed in the next two weeks.

-Matt

Hey Devingrant,

I've created a pull request that fixes the issue you're seeing. It can be found here:

https://github.com/apigee/microgateway-core/pull/53

-Matt