Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2359

rewrite() handler does not keep query parameters and query string in sync correctly

XMLWordPrintable

       

      This is actually an issue with the `RelativePathAttribute`, but it is most obvious when using it via the rewrite() handler.  Consider a URL like so:

      /old/path?foo=bar
      

      When using the rewrite() handler that includes  query string like so:

      rewrite( '/new/path?baz=bum' )
      

      the `RelativePathAttribute` attempts to keep the exchanges query params and query string in sync, but it does so poorly.  Dumping out that request will reveal the following

      parameter=foo=bar
      parameter=baz=bum
      queryString=foo=bar 

      The query string has been replaced with JUST the new query string from the rewrite() handler, yet the query parameter map in the exchange has been APPENDED to include both the new and the old parameters.  This is a similar but different issue to the ticket I logged here: UNDERTOW-2358

      This behavior causes issues with servlet apps that use the query string from the servlet request directly.  

      If the correct behavior is to discard the old query string, then the query parameter map needs overwritten, not appended to.  I'll be putting in another ticket soon to add a qsAppend flag to the rewrite handler.

       

              flaviarnn Flavia Rainone
              bdw429s Brad Wood
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: