Handling multiple domains using Externalizer | Community
Skip to main content
Level 6
June 18, 2021

Handling multiple domains using Externalizer

  • June 18, 2021
  • 3 replies
  • 3252 views

Hello All - Is there a way to configure the externalizer for multiple publish domains? We have 4 domains in our project and would like to maintain the externalizer config based on run-modes. In the externalizer config it says, we need to specify publish followed by domain to specify the configs. i.e 

publish www.example1.com

publish www.example2.com

publish www.example3.com

publish www.example4.com

How can I specify the configs. Since all are different domains.

 

com.day.cq.commons.impl.ExternalizerImpl

 

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

3 replies

mayank_saklech1
Level 2
June 18, 2021

Have you explored context-aware configuration for your problem? I believe you should be able to create separate configs for different paths of your repository.

Level 6
June 18, 2021
@mayank_saklech1 - Actually the same content slice (i.e /content/test/en/) is used for all four sites. we cannot use context-aware here as the path is same.
MandaPavanKumar
Level 2
April 11, 2023

Hi @test1234567,

    I tried using the different domains but when try to call them using externalizer api then it is throwing error that
error: cannot find the symbol:
[ERROR] variable PUBLISH_CA
[ERROR] location: interface Externalizer

This is the piece of code that I am using : 
externalizer.externalLink(resolver, Externalizer.PUBLISH_CA, "/my/page") + ".html";
can you please help me here.

 

Thanks,

Pavan

Asutosh_Jena_
Community Advisor
Community Advisor
June 19, 2021

Hi @test1234567 

 

You can define it in the OOTB configuration.i.e., with com.day.cq.commons.impl.ExternalizerImpl.xml and add the domain names. In your code you can read the configuration by passing the domain name.

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
externalizer.domains="[author http://localhost:4502,publish http://localhost:4503,website1 https://www.website1.com,website2 https://www.website2.com]"/>

 

Thanks! 

Level 2
November 10, 2022

This Doesn't actually work, not sure if there is any other customization needed on AEM on cloud.

shelly-goel
Adobe Employee
Adobe Employee
June 19, 2021

@test1234567  Once you define various domains in externalizer, you would be able to refer those in the code as below:

String myExternalizedUrl = externalizer.externalLink(resolver, Externalizer.LOCAL, "/my/page") + ".html";

July 19, 2022

Do we need to add this logic to very component?