ÃÛ¶¹ÊÓÆµ

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:

  1. Open the com.adobe.granite.cors.impl.custom-defined-CORS-config.cfg.json file in your codebase.

  2. Update the alloworiginregexpproperty 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": [
      
          "*"
      
      ]
      
  3. Redeploy the updated codebase to your production environment.

  4. Confirm that the Content Fragment Editor loads headless content without staying on the loading screen.

Content Fragment editor in AEM.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f