-
Enhancement
-
Resolution: Unresolved
-
Major
-
None
-
None
It is common, and very useful in other rewrite engines to have a flag similar to mod_rewrites `qsappend`, which merges the query strings of the rewritten URL instead of replacing the old query string. Appending query strings is already a pain due to these bugs:
https://issues.redhat.com/browse/UNDERTOW-2358
https://issues.redhat.com/browse/UNDERTOW-2359
In fact, the ONLY way to actually merge the actual query strings while accounting for an empty initial query string is to dig through the Undertow source and find the undocumented `%{BARE_QUERY_STRING}` placeholder!
I'm recommending a pragmatic approach to improve the rewrite() handler directly by adding an optional parameter called `qsappend` .
- When false (default), the original query string will be discarded IF the rewrite includes its own query string
- When true, the new and old query strings will be merged and both the query parameters and the query string in the exchange will be updated to reflect this.
rewrite( value='/new/path?baz=bum', qsappend=true )
Also consider adding a `qsdiscard` flag as well to borrow one more things from mod_cfml which would discard the original query string. This would be handy if you want to discard the old query string but not specify a new one.
- is related to
-
UNDERTOW-2358 QueryParameterAttribute doesn't update query string in exchange
- Open
-
UNDERTOW-2359 rewrite() handler does not keep query parameters and query string in sync correctly
- Open