Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Absolute urls in sitemap difference based on environment

Avatar

Level 2

Hi

 

I'm implementing the following configuration regarding the sitemap and use absolute urls.
https://experienceleague.adobe.com/docs/experience-manager-learn/sites/seo/sitemaps.html?lang=en#abs...

 

They are showing that you can add it on the /etc/map/https or /etc/map/http depending on your protocol.
These sling mappings are also used to rewrite the links on the page.

 

If you configure your domain name in the sling mapping that one is used everywhere (DEV, STG, PRD).
In the documentation they only mention that you can target the publish by using the map.publish.

 

If I follow the same approach as on the config with the runmodes I would have the following structure

/etc
/map
/https
/map.publish
/https
/map.publish.dev
/https
/map.publish.stage
/https
/map.publish.prod
/https

 

But the sling mappings that are configured over here aren't taken in consideration (the one from the map.publish) is everywhere used


I took a look at the JcrResourceResolverFactoryImpl OSGi config where you can add url Mapping.
But that will only replace it and you still would use the relative paths on the page and sitemap.

 

Anyone any idea?

 

Thanks

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

 

One solution could be to use the runmode specific OSGi configurations for the sling mapping, as you have suggested. However, you may need to make sure that the correct runmode is set on each instance so that the appropriate configuration is used.

Alternatively, you can consider using a reverse proxy to handle the absolute URLs. This way, you can configure the proxy to rewrite the URLs to the appropriate domain and path, regardless of the AEM instance. This approach can also help with caching and load balancing.

I hope this helps! Let me know if you have any further questions.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

Hi,

 

One solution could be to use the runmode specific OSGi configurations for the sling mapping, as you have suggested. However, you may need to make sure that the correct runmode is set on each instance so that the appropriate configuration is used.

Alternatively, you can consider using a reverse proxy to handle the absolute URLs. This way, you can configure the proxy to rewrite the URLs to the appropriate domain and path, regardless of the AEM instance. This approach can also help with caching and load balancing.

I hope this helps! Let me know if you have any further questions.