baiuu opened a new pull request, #13741:
URL: https://github.com/apache/apisix/pull/13741

   ### Description
   
   Fixes #13739 
   
   ### Description
   
   Resolve Nginx variables in the `error-page` plugin's `body` before returning 
custom error responses, using `core.utils.resolve_var` (same semantics as 
`response-rewrite` headers).
   
   Motivation: allow operators to embed the request ID (and other 
request-scoped variables) into custom error pages, so users can report the ID 
and admins can correlate the page with logs.
   
   Implementation notes:
   - Resolution happens in `header_filter`; the rendered body is cached in 
`ctx` and emitted by `body_filter`.
   - `Content-Length` is set from the **rendered** body to avoid truncation or 
connection stalls when resolution changes the body length.
   - If resolution fails, the original body is used and a warning is logged 
(fail-open, same spirit as static pages).
   - Bodies without `$` short-circuit before regex processing — zero overhead 
for existing configurations.
   
   ### Checklist
   
   - [x] New feature (non-breaking change which adds functionality)
   - [x] Added test cases in `t/plugin/error-page.t` (TEST 21–26: variable 
resolution, `${var}` form, `??` default value, `\$` escaping)
   - [x] Updated documentation (EN + ZH)
   - [ ] CI passed
   


-- 
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]

Reply via email to