Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3338

SlingHttpServletResponseImpl.encodeURL(String) and encodeRedirectURL(String) return wrong Url in multiple domain setups

    XMLWordPrintableJSON

Details

    Description

      The <c:url> JSTL tag (org.apache.taglibs.standard.tag.rt.core.UrlTag) does not work with multi domain mappings configured to the same path.

      org.apache.taglibs.standard.tag.rt.core.UrlTag uses
      org.apache.taglibs.standard.tag.common.core.UrlSupport which calls
      response.encodeURL(result); in the doEndTag method. That goes down to
      org.apache.sling.engine.impl.SlingHttpServletResponseImpl.encodeUrl(String).

      SlingHttpServletResponseImpl.encodeUrl calls SlingHttpServletResponseImpl.map(String) without the request. This can result in wrong mapping if more than one mapping matches always the frist one is picked.

      Can be reproduces by using the following mapping confighttp://localhost:4503/etc/map/http.tidy.-1.json):

      {
      "jcr:primaryType": "sling:Folder",
      "host-a1.com":

      { "jcr:createdBy": "admin", "sling:internalRedirect": [ "/content/a", "/" ], "jcr:primaryType": "sling:Mapping" }

      ,
      "host-a2.com":

      { "sling:internalRedirect": [ "/content/a", "/" ], "jcr:primaryType": "sling:Mapping" }

      }

      When using <c:url> to encode a link a request on host-a1.com works fine. The return value of the tag is a relative link. Access via host-a2.com is broken and <c:url> return a full link pointing to domain hoas-a1.com.

      Attachments

        Issue Links

          Activity

            People

              justinedelson Justin Edelson
              mhaack Markus Haack
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: