nic-6443 commented on issue #13163:
URL: https://github.com/apache/apisix/issues/13163#issuecomment-4676896122
This isn't something APISIX can detect or fix on its side — duplicate keys
in a JSON object are undefined behavior per RFC 8259, and the JSON parser
(lua-cjson, invoked in `apisix/admin/init.lua` before schema validation)
collapses them to the last value before the Admin API or the plugin ever sees
the config. Rejecting duplicate keys would require a custom JSON scanner over
the raw request body, which no JSON-based API I'm aware of does.
The practical way to express multi-value headers today is a comma-joined
value like `"add": {"foo": "bar2,bar3"}`, which is semantically equivalent for
comma-list headers per RFC 9110 — your own httpbin output (`"Foo":
"bar1,bar3"`) shows the append semantics work. Supporting array syntax like
`"foo": ["bar2", "bar3"]` in `headers.add` would be a reasonable feature
request though — the schema in `apisix/plugins/proxy-rewrite.lua` currently
only allows string/number values. I'd suggest closing this as a bug and
reframing the array-value support as a feature request so it can be discussed
on its own merits.
--
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]