Repository navigation
[Proposal] Query parameter rewriting in proxy-rewrite #14190
Replies: 1 comment
|
Grouping the operations under
Both {
"args": {
"add": {"tag": ["b", "c"]},
"set": {"page": "1"},
"remove": ["token"]
}
}Given Repeated query parameter names are valid and need to be preserved. Internally, the implementation should handle both scalar and multi-value representations, including appending to either without losing existing values or creating nested arrays. On the wire, multiple values should be emitted as repeated key-value pairs, preserving their order for the same key. Backend platforms may expose these as arrays or retain the first or last value, depending on their parser. APISIX should preserve the repeated pairs; a scalar With these semantics, a separate The execution order should be explicit and deterministic. One detail to clarify first: the current headers implementation executes |
Uh oh!
There was an error while loading. Please reload this page.
I'd like to discuss the configuration API for query parameter rewriting in
proxy-rewrite, related to #11237.The proposed operations are:
remove: remove all values for a parameter name.rename: rename a parameter while preserving its values.replace: replace all values only when the parameter exists.add: add a parameter only when it is absent.append: append a value, creating the parameter if it is absent.Before finalizing the implementation, I'd like feedback on the configuration structure and naming.
Would grouping these operations under
argsbe appropriate, consistent with how header operations are grouped underheaders?For example, one possible configuration would be:
{ "args": { "remove": ["token"], "rename": {"old": "new"}, "replace": {"a": "11"}, "add": {"b": "22"}, "append": {"c": "33"} } }Alternatively, would
queryorquerystringbe a clearer name? The example above is a proposed API for discussion, rather than the finalized configuration format.The current implementation executes the operations in the following order, regardless of the order of fields in the configuration:
remove → rename → replace → add → appendI'd also appreciate feedback on whether this execution order is appropriate.
The initial implementation supports literal values only, without dynamic templates.
Feedback on the naming, configuration structure, and operation semantics would be appreciated.
All reactions