You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Csaba Varga (Jira)" <ji...@apache.org> on 2022/09/26 11:20:00 UTC

[jira] [Commented] (SLING-11352) Cannot create path-only mapping rule in /etc/map

    [ https://issues.apache.org/jira/browse/SLING-11352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609444#comment-17609444 ] 

Csaba Varga commented on SLING-11352:
-------------------------------------

I have opened a PR with a proposed fix: [https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/84]

Could someone please take a look at it?

> Cannot create path-only mapping rule in /etc/map
> ------------------------------------------------
>
>                 Key: SLING-11352
>                 URL: https://issues.apache.org/jira/browse/SLING-11352
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.8.4
>            Reporter: Csaba Varga
>            Priority: Minor
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> I am trying to set up a mapping to make some of our site hierarchy appear on a different URL than what would be dictated by the hierarchy. My goal is to map the path /content/mycompany/locales/some_locale/sectionA to the URL /some_locale/sectionB . (I don't want to override the protocol, host and port fields.) Because we support multiple locales, I need to use a regex for setting up the matches. Here is my original attempt:
> {code:java}
> /etc/map/my_mapping
>      +-- sling:internalRedirect = /content/mycompany/locales/([-a-z]+)/sectionA
>      +-- sling:match = /$1/sectionB{code}
> When this node is present, /content/mycompany/locales/en-us/sectionA/foo gets mapped to /en-us://sectionB/foo instead of the intended /en-us/sectionB/foo.
> I can work around the issue by avoiding forward slashes in sling:match, but this is ugly and unclear :
> {code:java}
> /etc/map/my_mapping
>      +-- sling:internalRedirect = /content/mycompany/locales/([-a-z]+)(/)sectionA
>      +-- sling:match = /$1$2sectionB {code}
> Is this kind of mapping supported at all? I would rather avoid adding the hostname to mapping rules because it is environment-specific.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)