Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Links to pages that use aliases are referencing incorrect domain inside Personalized container

sharms13
Level 2
Level 2

Hi All,

 

We are facing an issue when their is a personalized container which have fixed list component configured inside it and it  has the list of pages selected.

Now out of them one page which is selected by the author have an alias configured on it.

Now when the component is rendered on the publish \ dispatcher URL the one which had alias show the incorrect domain and the other which doesn't have the alias points to correct domain.

 

This is happening when their is a combination of aliases and the personalisation container.

As a workaround we removed the alias from the page but any help on how to resolve this issue will be appreciated.

 

Regards,

Shikha

 

 

3 Replies
asutosh_jena
Community Advisor
Community Advisor

Hi @sharms13 

If I understand this issue correctly:

  1. You have multi domain websites configured on your instance.
  2. You have some personalization container (loaded via adobe target?) which has list of URLs configured on it along with alias.
  3. When the page is accessed via publish/dispatcher URL, the links are showing the correct URL(alias) with wrong domain name. i.e. let's say if you are expecting a link as www.something.com/abc/xyz you are getting it as www.something123.com/abc/xyz where www.something123.com is another domain within your system hosted website?
  4. You also have URL shortening enabled using etc/maps?
  5. If you use alias for other URLs where the content is not served using the personalization block is working perfectly fine?

Please let me know if I understood the issue correctly and then I might be able to help you.

 

Thanks!

nitinfuture
Level 1
Level 1
Hi @asutosh_jena, You have understood the problem correctly, only thing is we are using custom personalization logic where by making a direct call to the component using SlingRequestProcessor API to get the HTML and adding to the DOM. In this HTML, if there are any links to a page is getting mapped to a wrong domain. Can you please let us know if the links can be corrected in the component HTML response in publisher/dispatcher instance that we receive from this API call. We see the same issue from resource resolver utility on system console, when we try to map a resource path, is adding wrong domain. Thanks.
asutosh_jena
Community Advisor
Community Advisor

@sharms13 @nitinfuture 
When we will use sling:alias for any of the page content, sling:alias will always take precedence over the page path and will always resolve as a link for any of the resource.
So let's say you have a page as /content/xyz/en_us/about.html which is served as www.abc.com/about and you have a sling:alias as about_new for it, then it will start resolving as www.abc.com/about_new.

Having said that both the resource will be serving the same content i.e about.html contnet.

 

What I understood is this is not wokring in this case here and now to make this work we will need to use the Resource Resolver Mapping.

You can use the below method to map the resource by passing the incoming URL into the map() and it will give the shortened URL with sling:mapping path in your component.

 

resourceResolver.map(sourceURL);

Rewriter configuration:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
contentTypes="[text/html]"
enabled="{Boolean}true"
generatorType="htmlparser"
order="1"
paths="[/content/abc/]"
serializerType="htmlwriter"
transformerTypes="[linkchecker,versioned-clientlibs,resourceresolver-map]">
<generator-htmlparser
jcr:primaryType="nt:unstructured"
component-optional="{Boolean}true"
includeTags="[A,/A,IMG,SOURCE,/SOURCE,LINK,SCRIPT,FORM]"/>
</jcr:root>

Also ensure that you have the link rewriter configured with the path such as /content/xyz/en_us which will shorten the URL and map it with etc/maps that is configured for the brand and it will resolve the binding of other domain into URL.

 

Please refer the link below:

https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html

 

 Thanks!