*** The wcm.io Project is closing down this JIRA Instance in favor of GitHub issues. ***
Please use the corresponding GitHub projects to report issues - or the mailing list for general discussion.
This works fine for the tenant itself. However other tenants that have their own domain but no sling mapping (no URL shortening) get a problem. If a tenant has no sling mapping, all their URLs get rewritten with the last domain in the mapping table. This is because the last entry in the mapping table is the root path "/" which matches to every path. The sling mapper uses in this case the last domain
This is specially the case on testing and staging systems where multiple tenants are deployed but not all of them need URL-shortening.
Solutions: We must not generate any external mappings for the root path. Following configurations would solve this error. I prefer option 2 because of clearer hierarchy.
Currently the sling mappings generated by aem-definitions for a tenant is like this:
/etc/map/https +- example.com @sling:internalRedirect=["/","/content/region/site"]This works fine for the tenant itself. However other tenants that have their own domain but no sling mapping (no URL shortening) get a problem. If a tenant has no sling mapping, all their URLs get rewritten with the last domain in the mapping table. This is because the last entry in the mapping table is the root path "/" which matches to every path. The sling mapper uses in this case the last domain
For example if the page http://myothersite.com/content/myothersite/en.html has a link like this
<a href="/content/myothersite/en/contact.html">Contact us</a>it's URL is rewritten to http://example.com/content/myothersite/en/contact.html which is obviously the wrong domain
This is specially the case on testing and staging systems where multiple tenants are deployed but not all of them need URL-shortening.
Solutions:
We must not generate any external mappings for the root path.
Following configurations would solve this error. I prefer option 2 because of clearer hierarchy.
Option 1)
/etc/map/https +- example.com | @sling:match = "example.com/(.*)" | @sling:internalRedirect = ["/$1","/content/region/site/$1"] +- example.com_reverse | @sling:match = "example.com/$1" | @sling:internalRedirect = ["/content/region/site/(.*)"]Option 2)
/etc/map/https +- example.com | | @sling:internalRedirect = ["/content/region/site"] | | | +- content-mapping | | @sling:match = "(.+)$" | | @sling:internalRedirect = ["/$1","/content/region/site/$1"] | | | +- reverse-content-mapping | | @sling:match = "$1" | | @sling:internalRedirect = ["/content/region/site/(.*)"]