-
Bug
-
Resolution: Done
-
Major
-
2.0.3.Final, 2.0.13.Final
-
None
When redirecting to a relative URL, the current URL is not correctly URL encoded. For example, take these redirections:
16:59:31,245 INFO [stdout] (default task-1) Request at /testredirect-1.0-SNAPSHOT/ 16:59:31,245 INFO [stdout] (default task-1) Redirecting to: http://localhost:8080/testredirect-1.0-SNAPSHOT/invalid-%5B123%5D/main 16:59:31,255 INFO [stdout] (default task-1) Request at /testredirect-1.0-SNAPSHOT/invalid-%5B123%5D/main 16:59:31,264 INFO [stdout] (default task-1) Redirecting to: http://localhost:8080/testredirect-1.0-SNAPSHOT/invalid-[123]/subpath (using sendRedirect("./subpath")) 16:59:31,265 INFO [stdout] (default task-1) Request at /testredirect-1.0-SNAPSHOT/invalid-[123]/subpath
The problem seems to be in io.undertow.servlet.spec.HttpServletResponseImpl.sendRedirect. Here String current = exchange.getRelativePath(); returns the path unencoded as '/invalid-[123]/'. This ends up in realPath and loc.
I've attached a very simple example application that shows the erroneous redirect. Deploy this application and navigate to http://localhost:8080/testredirect-1.0-SNAPSHOT/.
- causes
-
JBEAP-23581 [GSS](7.4.z) UNDERTOW-2094 - Bad relative redirect is generated if app is mapped to trailing slash context
- Closed
-
UNDERTOW-2094 Bad relative redirect is generated if app is mapped to trailing slash context
- Closed