Replies: 1 comment 2 replies
-
Hi @gregor-4E were you able to figure this out? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi folks,
We have created our own plugin and we would like to return the nginx error pages using nginx
error_page
directive with it, if the upstream returns a server error (basically if upstream http status is >= 500). However, there is a catch. We also use theapi-breaker
plugin which uses the log phase to increase its error count for enabling the breaker, so we cannot simply usecore.response.exit(500)
in header_filter phase, because it would circumvent the api breaker log phase.What we have tried so far:
core.response.exit(500)
inheader_filter
phase -> Does everything we want, but renders theapi-breaker
plugin useless (log phase will not run)ngx.status = 500
andngx.exit(0)
-> Will return upstream response body and content type headers, so not what we need, we need the nginx integratederror_page
directive to workctx
aftercore.response.exit
-> Works, but feels increadibly hacky, so would like to avoid itresponse-rewrite plugin
-> We have template variables in our error pages (e.g. zipkin trace id), how would we be able to make use of the nginx variable interpolation for error pages here?proxy_intercept_errors on
with nginx -> We also haveerror_page
directive enabled for other error codes < 500 (in case other plugins exit with such statuses), however, if the upstream returns such a status, we would like to return the original response of the upstreamOf course, we are unsure, if we are even on the right track, so if you have ideas on how to solve this without a custom plugin, we are happy to hear your suggestions.
Thanks and best regards
Gregor
Beta Was this translation helpful? Give feedback.
All reactions