Hi Community,
Do we have a way to implement redirection using /etc/map configuration for different environment, for example: /etc/map.qa.publish and /etc/map.prod.publish. There are also other apps hosted in the same instance, so we do not want to completely overwrite the regular '/etc/map' mapping location for this change, as it could disturb the configurations present for other websites.We are using CQ 5.6 version.
Is any structure possible which could accommodate this request?
Solved! Go to Solution.
Views
Replies
Total Likes
@avni27 I think this should be possible, but you will probably need to copy all generic mappings under more specific path, so i.e. under /etc/map.qa.publish you can store all specific mapping for qa env and all generic ones, and similar approach for /etc/map.prod.publish. This is of course not the ideal approach, and you will need to keep and manage generic mappings in multiple places but in the other hand all the rest you got out of the box. So if generic mappings are not changed too often, this could be an acceptable compromise.
Hi @avni27, in general you can point to specific mapping location using org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl OSGi configuration - changing value of resource.resolver.map.location
In other words, you can have dedicated OSGi configuration for each environment, base on run mode different OSGi configuration will be applied. Inside each configuration you can set mapping location specific for given environment.
Hi @lukasz-m ,
Thanks for replying, However
I have customized the configuration - org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl but this makes the environment specific '/etc/map' location default for all applications sharing the instance.
There are 3 applications using served from this instance, A, B and C.
Two of them, A and B already use the generic sling mappings for all environments, the nodes fall under '/etc/map' location. I will need them to work along with the fix.
While the requirement of the third application, C is to have different environment dependent sling mappings, hence created /etc/map.qa.publish and /etc/map.prod.publish.
So the problem is - if my customization overwrites the path of 'Mapping location' to /etc/map.qa.publish then the other mappings won't be effective.
@avni27 I think this should be possible, but you will probably need to copy all generic mappings under more specific path, so i.e. under /etc/map.qa.publish you can store all specific mapping for qa env and all generic ones, and similar approach for /etc/map.prod.publish. This is of course not the ideal approach, and you will need to keep and manage generic mappings in multiple places but in the other hand all the rest you got out of the box. So if generic mappings are not changed too often, this could be an acceptable compromise.
That's correct @lukasz-m I have not copied the other mappings into /etc/map.qa.publish and /etc/map.prod.publish as it will result in having redundant data.
Views
Replies
Total Likes
The Sling Mapping configuration is global for the whole AEM instance, you cannot decide on a per-page/request/... basis to use a specific mapping.
Instead you should adjust your mapping that it can work for all type of pages for your instance, and due to the structure of the mappings, this is definitely possible. I did not came across a situation where it was required to use distinct mapping configurations.
Thanks @Jörg_Hoh ,
Adding mapping for qa.publish and prod.publish worked out. I have decided to keep '/etc/map' folder as it is and have separate sling:folder with different mappings for qa and prod matching their domains they will pick the sling:redirect appropriately. So the structure now is :
/etc
/map
/qa.C.publish
/prod.C.publish
/A.publish
/B.publish
Views
Replies
Total Likes