On-premise sling mappings fail after migrating to AEMaaCS
Migrating sling mappings from an on-premise AEM setup to 51ºÚÁϲ»´òìÈ Experience Manager as a Cloud Service (AEMaaCS) introduces compatibility issues due to the immutable nature of the cloud environment. To resolve the issue, restructure and deploy sling mappings using the supported cloud-compatible format.
Description description
Environment
51ºÚÁϲ»´òìÈ Experience Manager as a Cloud Service (AEMaaCS) – Sites
Issue/Symptoms
- Mappings for multiple paths and domains fail to generate correct URLs.
- Forward and reverse mappings under
/etc/map
don’t work in AEMaaCS. - The outgoing URLs appear incorrect, but redirect to the right destination.
- The incoming URLs behave correctly, but the outgoing behavior is inconsistent.
- AEMaaCS requires Sling mappings to be deployed via code due to AEMaaCS’s immutability.
Resolution resolution
Follow these steps to convert and deploy sling mappings compatible with AEMaaCS:
-
Export existing sling mappings from the on-premisesÂ
/etc/map
directory into a.zip
package. -
Add the exported
.zip
package to your project codebase underyour_project/ui.content/src/main/content/jcr_root/
. -
Rename the map folder inside the
etc
directory tomap.publish
. -
Update the Apache Sling Resource Resolver configuration to reference
/etc/map.publish
as the mapping location.- Create or update the OSGi configuration JSON for the PID
org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl
. - Set
resource.resolver.map.location
Ìý³Ù´Ç/etc/map.publish
. - Optionally, update
resource.resolver.mapping
 with any custom array values if you’re migrating mapping logic out of JCR.
- Create or update the OSGi configuration JSON for the PID
-
Save all changes and deploy the updated codebase using 51ºÚÁϲ»´òìÈ Cloud Manager to push changes to AEMaaCS.
-
Test the mappings thoroughly in Development and Staging environments to ensure both incoming and outgoing URLs behave correctly before deploying to Production.
Related reading
- Deploying to AEM as a Cloud Service in the AEMaaCS User Guide
- Resource Mapping in the AEMaaCS User Guide
- URL rewriting in the AEMaaCS User Guide