apisix
apisix copied to clipboard
fix(forward-auth): client body can not send to upstream after forwarding it to auth. service
fix(forward-auth): client body can not send to upstream after forwarding it to auth. service
Description
Fixes https://github.com/apache/apisix/issues/11050 Fixes https://github.com/apache/apisix/issues/11200
- sync. with Nginx using ngx.req.<init|append|finish>_body APIs while forwarding/streaming to auth. svc
- consider the case of conf.allow_degradation == true
- delay invoking "get_client_body_reader() -> ngx.req.socket()"
-- once invoking ngx.req.socket() would stop NGX from reading client body causing 504 issue -- why there is such a performance needs further clarification -- delay the invoking in order to follow the normal proxy_pass flow rather than buffering -- the client body by the plugin in case of client body has not started to read, -- e.g. auth svc. is unable to connect and allow_degradation is true
- suggest adding the following config field
-- suggest adding this switch forward_client_body = {type = "boolean", default = true},
Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [x] I have updated the documentation to reflect this change
- [x] I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)