You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "MariaLapovska (via GitHub)" <gi...@apache.org> on 2026/02/16 21:08:57 UTC
[I] bug: Header values modified by ext-plugin-pre-req/ext-plugin-post-req not applied in ext-plugin-post-resp [apisix]
MariaLapovska opened a new issue, #13015:
URL: https://github.com/apache/apisix/issues/13015
### Current Behavior
When I modify request headers in ext-plugin-pre-req/ext-plugin-post-req and have ext-plugin-post-resp in the route, the header values I set in the request plugins are ignored and not passed to the upstream. Upstream ends up receiving original header values, instead of modified ones.
### Expected Behavior
I expect all the request header values changed in ext-plugin-pre-req/ext-plugin-post-req, to be passed to upstream, no matter whether I have ext-plugin-post-resp called after, or not.
It seems I've identified the source of the problem - it happens because ext-plugin-post-resp is using cached request headers when calling upstream:
https://github.com/apache/apisix/blob/master/apisix/plugins/ext-plugin-post-resp.lua#L39
If I enforce it to pull the latest request headers by resetting the context (modify ext-plugin-post-resp.lua):
```
local function include_req_headers(ctx)
-- TODO: handle proxy_set_header
ctx.headers = nil -- EDIT: enforce apisix to pull the latest headers
return core.request.headers(ctx)
end
```
it works fine and the proper header values are injected when calling upstream.
### Error Logs
_No response_
### Steps to Reproduce
1. Run APISIX
2. Create a route that would have two plugins - ext-plugin-pre-req and ext-plugin-post-resp
3. Modify any of the request headers in ext-plugin-pre-req
4. Try to make call to upstream
5. Check what header value ends up passed to upstream
### Environment
- APISIX version (run `apisix version`): 3.13.0
- Operating system (run `uname -a`): Darwin 25.2.0
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): 9.7.3
- APISIX Dashboard version, if relevant: 0.8.2
- Plugin runner version, for issues related to plugin runners: ext-java-plugin-runner 0.6.0
- LuaRocks version, for installation issues (run `luarocks --version`):
--
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: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Header values modified by ext-plugin-pre-req/ext-plugin-post-req not applied in ext-plugin-post-resp [apisix]
Posted by "MariaLapovska (via GitHub)" <gi...@apache.org>.
MariaLapovska commented on issue #13015:
URL: https://github.com/apache/apisix/issues/13015#issuecomment-3915607960
@shreemaan-abhishek
In the java plugin runner:
```java
public class AuthorizationFilter implements PluginFilter {
@Override
public void filter(HttpRequest request, HttpResponse response, PluginFilterChain chain) {
//... some logic ...
request.setHeader(AUTHORIZATION, AUTHORIZATION_PREFIX_BEARER + " " + cachedToken);
}
}
public class PostRespFilter implements PluginFilter {
@Override
public void postFilter(PostRequest request, PostResponse response, PluginFilterChain chain) {
//... some logic ...
response.setStatusCode(200);
}
}
```
In the route config:
```yaml
routes:
- id: oauth-token
uri: /token/swap
upstream:
pass_host: "node"
nodes:
"wiremock:8080": 1
type: roundrobin
plugin_config_id: 1
plugin_configs:
- id: 1
plugins:
ext-plugin-pre-req:
conf:
- name: "AuthorizationFilter"
value: ""
ext-plugin-post-resp:
conf:
- name: "PostRespFilter"
value: ""
```
When I enable logs in upstream I can see that authorization header value is never updated to the value set in AuthorizationFilter, but instead is the original value passed in request. But when I remove PostRespFilter from that route config, the value is propagated correctly.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Header values modified by ext-plugin-pre-req/ext-plugin-post-req not applied in ext-plugin-post-resp [apisix]
Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #13015:
URL: https://github.com/apache/apisix/issues/13015#issuecomment-3913043461
> When I modify request headers in ext-plugin-pre-req/ext-plugin-post-req and have ext-plugin-post-resp
how do you do that?
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Header values modified by ext-plugin-pre-req/ext-plugin-post-req not applied in ext-plugin-post-resp [apisix]
Posted by "nic-6443 (via GitHub)" <gi...@apache.org>.
nic-6443 closed issue #13015: bug: Header values modified by ext-plugin-pre-req/ext-plugin-post-req not applied in ext-plugin-post-resp
URL: https://github.com/apache/apisix/issues/13015
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Header values modified by ext-plugin-pre-req/ext-plugin-post-req not applied in ext-plugin-post-resp [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #13015:
URL: https://github.com/apache/apisix/issues/13015#issuecomment-3949880942
This problem is similar to #4271
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org