Description
Current Behavior
The current priority for header operations is: add > remove > set
. This makes it impossible to handle the use-case where you want to add multiple headers with the same name but first remove all the headers with that name. The following configuration would make sense in my opinion:
"proxy-rewrite": {
"headers": {
"remove: ["foo"]
"add": {
"foo": "bar1",
"foo": "bar2",
}
}
}
But due to the header priority add > remove > set
this leads to no foo headers, as first they are added and then all removed again.
Expected Behavior
The expected behaviour would be to have both foo headers added and all earlier foo headers removed. For this to work the priority order should be remove > set > add
. The set
operation is basically a shortcut for remove, add
but is confusing when you need a header multiple times, which set does not allow.
Error Logs
No response
Steps to Reproduce
- Run APISIX via docker image
- Create a route:
{
"uri": "/*",
"name": "httpbin-demo",
"host": "httpbin.org",
"upstream": {
"scheme": "https",
"type": "roundrobin",
"nodes": {
"httpbin.org:443": 1
}
},
"plugins": {
"proxy-rewrite": {
"headers": {
"remove": ["foo"],
"add": {
"foo": "bar2",
"foo": "bar3"
}
}
}
}
}
- Test using `curl -H"foo: bar1" -H"Host: httpbin.org" http://localhost:9080/anything
The resulting json is missing the expected foo: bar1
and foo: bar2
headers.
Environment
- APISIX version (run
apisix version
): Stock docker container with version 3.10.0 - Operating system (run
uname -a
): Not relevant, but Ubuntu 24.04 LTS - OpenResty / Nginx version (run
openresty -V
ornginx -V
): - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info
): Not relevant - APISIX Dashboard version, if relevant: Not relevant
- Plugin runner version, for issues related to plugin runners: Not relevant
- LuaRocks version, for installation issues (run
luarocks --version
): Not relevant
Metadata
Metadata
Assignees
Labels
Type
Projects
Status