-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
request help: Support customizing the body when response exits #3565
Comments
I think we can do it. |
Refer to custom-error-pages feature provided by Ingress Using a docker image as backend to deal with specific error code, and pass params through header
I think we can use header too, and list all support headers in doc for extension |
Maybe we can implement a minimal version, just like your original reply. If we try to add too much things in a PR, there will be too much arguments. |
@nanamikon |
nice issue, we can support this feature |
ok, I will submit a PR |
hi, I wan't to know , this feat is support? |
@qq54903099 AFAIK, the feature is still not supported yet, Would you like to have it a try ? |
Err... I prefer the solution in #6040 (review) But anyway, we should have a detailed discussion about the goal & the approach before we start. |
Issue description
Relate to #3528
I think we can add a feature to customize the body when response exits. For example, different format of json, even html
or xml , can be use to display the exit message
Refer to apisix/core/response.lua, resp_exit will be called when response exits, I think it is a global handle for response exiting, we can't use plugin extension here。 What about redirecting to a new uri to do the actual work ?
Add method
Modify apisix/core/response.lua
Add exec to redirect to error handle
Add new config to change this behavior
New uri for error handle,added by http_server_configuration_snippet
Some discussion about kong
1 Kong error response
Kong/kong#3192
2 Upstream error response
Kong/kong#972
Environment
apisix version
):2.2uname -a
):ubuntu 16nginx -V
oropenresty -V
): 1.19curl http://127.0.0.1:9090/v1/server_info
to get the info from server-info API):3.4.17The text was updated successfully, but these errors were encountered: