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

Bad relative redirect is generated if app is mapped to trailing slash context

XMLWordPrintable

      If an app is bound to a context with a trailing slash:

      <context-root>/app/</context-root>
      

      Then relative redirects can be incorrect. For instance, if requesting /app/redirect.jsp then response.sendRedirect("newpage.jsp") would previously return a location of /app/newpage.jsp. But now it results in /app/redirect.jspnewpage.jsp.

      That's because after UNDERTOW-1409, this:

                          current = current.substring(0, lastSlash + 1);
      

      Does not see a last slash and so does not modify the current string, meaning that this:

                      realPath = CanonicalPathUtils.canonicalize(servletContext.getContextPath() + current + location);
      

      ends up being called with values like /app/+redirect.jsp+newpage.jsp.

            flaviarnn Flavia Rainone
            rhn-support-aogburn Aaron Ogburn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: