-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EG should allow developer to define errors in Proxy Policy #692
Comments
The error handler is here Not to sure how we can implement a declarative yet flexible error handler. |
@XVincentX Hi, I had the same problem. I need to always return the JSON. How can I send an error (JSON obj) if not one condition.pattern does not match?
|
@WebWorkDeveloper Your issue is not really connected to this one. This one is about customizing proxy errors — you just want to return a JSON payload in case something goes wrong. We do not have a direct way to do that right now; you can use the expression policy to execute a small javascript code which can return the response you need. |
@XVincentX I'm probably missing something but how would you use an expression to do this ? If I understand correctly there's no way to have access to the proxy error or proxied response out of the proxy policy implementation. |
At the moment, if a request is unauthorized or a service endpoint becomes unavailable, EG simply returns plain text responses, such as "UNAUTHORIZED" or "BAD GATEWAY".
EG should allow the developer to decide how the error is returned, for example a JSON response or a HTML response and gracefully fallback to the plain text errors if these are not defined by the developer.
The text was updated successfully, but these errors were encountered: