Headless content not loading in AEM as a Cloud Service - Sites
Headless content fragments fail to load in the new Content Fragment Editor in AEM as a Cloud Service (AEMaaCS). It happens due to an invalid regular expression in the CORS (Cross-Origin Resource Sharing) configuration file. To fix this, update the alloworiginregexp
property, verify your regex, and redeploy the updated configuration.
Description description
Environment
ÃÛ¶¹ÊÓÆµ Experience Manager as a Cloud Service (AEMaaCS) - Sites
Issue/Symptoms
-
The Content Fragment Editor stays stuck on a loading screen.
-
Headless content fragments under Assets do not load.
-
The system fails to activate the CORS filter due to an invalid regular expression in the CORS configuration file (CORSPolicyImpl custom-defined-CORS-config.cfg.json).
-
Network requests fail because of missing CORS headers.
-
The configuration file uses an incorrect value for theÂ
alloworiginregexp
Ìý±è°ù´Ç±è±ð°ù³Ù²â. -
If you see an installed component from your custom CORS configuration (as shown in the screenshot), it means the OSGi configuration package has been deployed to your AEM as a Cloud Service environment. Since you can’t access the OSGi Web Console directly, use the Developer Console to check the component’s status and configuration.
Resolution resolution
To resolve this issue, follow these steps:
-
Open the
com.adobe.granite.cors.impl.custom-defined-CORS-config.cfg.json
file in your codebase. -
Update the
alloworiginregexp
property if it contains an invalid value.-
Check that the regular expression is valid.
-
Avoid using .* . Replace it with a valid pattern such as .\* Â or another valid regular expression that aligns with your requirements.
Example:
code language-none Corrected "alloworiginregexp": [ Â Â ".*" ] Problematic "alloworiginregexp": [ Â Â "*" ]
-
-
Redeploy the updated codebase to your production environment.
-
Confirm that the Content Fragment Editor loads headless content without staying on the loading screen.
Related reading
Content Fragment editor in AEM.