How can AEM add hostnames? | Community
Skip to main content
jkpanera
Level 4
May 6, 2019

How can AEM add hostnames?

  • May 6, 2019
  • 1 reply
  • 14470 views

Hi guys,

We are seeing an issue in our production environment where links are being incorrectly substituted. Our author (and our code) only select resources from the JCR to build links. AFAIK, the links should be relative but we are actually seeing host names in the links.

For instance, if an author selects the resource /content/domain_com/en-us/locator, we expect to see the HTML:

  <a class="block-level list-item-link" href="https://forums.adobe.com/content/domain_com/en-us/locator.html" title="Locations" target="_self">Locations</a>

And in most environments, we do see that, but intermittently, we see this:

  <a class="block-level list-item-link" href="https://test-host.domain.com:4503/content/domain_com/en-us/locator.html" title="Locations" target="_self">Locations</a>

Ironically, we only see that in production.

We do have some sling redirects set up, but I'm not sure if they are the cause. My understanding is that they will only change relative paths-not add on a hostname.

The relevant sling redirect could be this:

/etc/map/http/test-host.domain.com.4503/content/panerabread_com/en-us.json

  {

"jcr:primaryType": "sling:Mapping",

"jcr:mixinTypes": [

"cq:ReplicationStatus"

],

"jcr:createdBy": "admin",

"jcr:created": "Fri May 18 2018 15:29:02 GMT-0500",

"sling:match": "en-us",

"sling:internalRedirect": [

"/content/domain_com/en-us",

"/content/domain_com/en-us/content"

]

}

But I'm not really sure.

FYI, we are running 6.3 SP1.

Any help would be appreciated.

Thanks much!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Adobe Employee
May 6, 2019

Setup a DEBUG level logger on "org.apache.sling.resourceresolver" and compare it with a working instance.

jkpanera
jkpaneraAuthor
Level 4
May 7, 2019

Thanks for your prompt reply JaideepBrar. I'll try to get the logging added in production.  In the meantime, I poked around a bit and found this:

http://<publishhost>:4503/system/console/jcrresolver

There are five sections:

Configuration, Configuration Test, Resolver Map Entries, and Mapping Map Entries.

Resolver Map Entries look reasonable for the most part. They are things like:

Pattern:

https/test-host.domain.com.4503/content/domain_com/en-us

Replacement:

/content/domain_com/en-us

Redirect:

Internal

Fine. No problem. Then I look farther down at Mapping Map Entries. And I see:

Pattern:

^/content/panerabread_com/en-us/content

Replacement:

http://test-host.domain.com:4503/content/domain_com/en-us

http://another-test-host.domain.com:4503/content/domain_com/en-us

....

http://another-test-host.domain.com:4503/content/domain_com/en-us

Redirect:

external: 302

I can send a screenshot of the actual jcrresolver console, but I can't post it on the open web.

Here's the thing. We don't want any external redirects. We create all of our sling redirects as above (using sling:internalRedirect). Apparently it does both? Not sure how we can create a redirect that doesn't create a mapping both directions.

Hemant_arora
Level 8
May 7, 2019

Have you checked the mapping entry specification ?

Apache Sling :: Mappings for Resource Resolution

follow the example given in the above link and make appropriate entry