api7 / api7/apisix-nginx-module
plugin proxy_control does not work as expected
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 45
- Forks
- 25
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 1
Description
**The plugin will not work as expected when a module has read request body in the phase before proxy_pass **
A similar one I mentioned in https://github.com/apache/apisix/issues/10379
I add log print below and plugin proxy_control set variable of request_body_no_buffering to 1 indeed.
static ngx_int_t
ngx_http_proxy_handler(ngx_http_request_t *r)
{
...
#if (NGX_HTTP_APISIX)
if (!ngx_http_apisix_is_request_buffering(r, plcf->upstream.request_buffering)
#else
if (!plcf->upstream.request_buffering
#endif
&& plcf->body_values == NULL && plcf->upstream.pass_request_body
&& (!r->headers_in.chunked
|| plcf->http_version == NGX_HTTP_VERSION_11))
{
// add log print
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"========set request_body_no_buffering=======" );
r->request_body_no_buffering = 1;
}
...
ngx_int_t
ngx_http_read_client_request_body(ngx_http_request_t *r,
ngx_http_client_body_handler_pt post_handler)
{
size_t preread;
ssize_t size;
ngx_int_t rc;
ngx_buf_t *b;
ngx_chain_t out;
ngx_http_request_body_t *rb;
ngx_http_core_loc_conf_t *clcf;
r->main->count++;
if (r != r->main || r->request_body || r->discard_body) {
r->request_body_no_buffering = 0; // if request body has been read before, set back to 0
post_handler(r);
return NGX_OK;
}
...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ngx_http_proxy_handler and ngx_http_read_client_request_body, focusing on request_body_no_buffering after a module reads the request body before proxy_pass. Compare the behavior with the related apisix issue 10379 and verify that proxy_control handles this request path as intended; the issue names no test or explicit acceptance case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100