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

Reverse Proxy: URL paths are incorrectly encoded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.2.0.Beta9
    • None
    • Core
    • None

      When using the reverse proxy, url paths are encoded using the wrong type of encoding. It is using the awfully named java.net.URLEncoder which cannot be used to encode paths within a url.

      https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java#L704

      What is happening is a proper url such as http://localhost:8080/foo%20bar gets sent across as http://localhost:8080/foo+bar which is incorrect.

      An excellent blog post on the different types of url encoding can be found here http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding
      [the only thing that post doesn't tell you is how to property encode paths in java, but I believe its as simple as something like new URI(null, null, myPath, null).getRawPath()]

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              mwringe Matt Wringe
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: