membphis commented on PR #13727:
URL: https://github.com/apache/apisix/pull/13727#issuecomment-6628203255
I reproduced a compatibility regression in the patch at
`66697af81af8f9cd5100335d15cec05cd8b3ac58`: the response-rewrite header and
body phases can make different `_meta.filter` decisions.
For an upstream that returns status 200 and body `hello world\n`, configure:
```json
{
"uri": "/hello",
"upstream": {
"type": "roundrobin",
"nodes": {"127.0.0.1:1980": 1}
},
"plugins": {
"response-rewrite": {
"_meta": {"filter": [["status", "==", 200]]},
"status_code": 403,
"body": "rewritten body"
}
}
}
```
| Version | Response status | Response body |
| --- | --- | --- |
| Baseline | 403 | `rewritten body` |
| Baseline with this PR applied | 403 | `hello world\n` |
In `header_filter`, the condition matches status 200 and response-rewrite
changes it to 403. In `body_filter`, the phase-specific cache key causes the
condition to be evaluated again. Since `status` is now uncached, it reads 403,
fails the condition, and the dispatcher skips the body callback. The existing
shared decision allowed both operations to complete.
I tested this by applying the patch to
`master@79a87e559f6bec9a018ca4466e31b43ef9650e81` in an isolated APISIX runtime
1.4.2 environment. The six relevant test files (`ctx2.t`, `file-logger.t`,
`file-logger2.t`, `file-logger3.t`, `plugin.t`, and `response-rewrite.t`)
passed all 392 assertions, but a dedicated regression for the configuration
above passed 6/6 assertions on the baseline and 5/6 with this patch; the
response-body assertion failed. A fresh rerun reproduced the same result.
Please preserve the shared decision across the response header/body phases
and add this regression case. A narrower approach is to retain the uncached
`status` fix and give only the `log` phase an independent filter-result cache,
leaving the other phases on their existing shared decision.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]