Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM 6.5: Adding custom Factory configuration for CORS does not work anymore

Avatar

Level 3

We tried to update our CORS configuration in AEM 6.5.0.0 according to this help article: Adobe Experience Manager Help | Understanding Cross-Origin Resource Sharing (CORS) with AEM .

But this does not seem to work (anymore). If we follow the guide and add it to your package and deploy it again. It does not recognize it as an instance of the CORS configuration factory component.

We have the same issue with adding a custom Logging to the LogFactory, as documented here: Monitoring and Maintaining Your AEM instance

Do you have the same issue? We haven't tested it yet with the latest AEM 6.4.x.

Thanks for support.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Ahh so we have found now the solution: We needed to rename the config xml file to "com.adobe.granite.cors.impl.CORSPolicyImpl-IDENTIFIER.xml".

So we needed to add a Dash between the Factory PID and the IDENTIFIER.

Before we added manually via the Felix Config console the additional config and then we simply packaged up the stored config nodes from the CRX. But this procedure seems not to work for Factory configs.

Actually this is also documented here: Configuring OSGi in a special Note box .

View solution in original post

8 Replies

Avatar

Employee Advisor

As mentioned at [1], Setup the following logging to check why its failing:

Logging is available under com.adobe.granite.cors:

  • enable DEBUG to see details about why a CORS request was denied
  • enable TRACE to see details about all requests going through the CORS handler

[1] Adobe Experience Manager Help | Understanding Cross-Origin Resource Sharing (CORS) with AEM

Avatar

Level 3

Hi JaideepBrar​,

sorry need to correct my initial description: The configuration worked so far for one added custom configuration, but it is displayed not right below the "Adobe Granite Cross-Origin Resource Sharing Policy" in the Felix Configuration view, which was a bit confusing.

Screenshot:

aem65-cors-config-factory-issue01.jpg

Avatar

Employee Advisor

I believe you need to match the pid in order for it to show up under the CORS config. Check screenshot below:

Screen Shot 2019-05-14 at 10.15.31 AM.png

Avatar

Level 3

As you can see JaideepBrar​ in my previous comment with the Screenshot, we used actually the same PID ("com.adobe.granite.cors.impl.CORSPolicyImpl.c9d2e058-2403-43ac-8755-a5693ddf4ae8")...that's why we are a bit confused....

Avatar

Correct answer by
Level 3

Ahh so we have found now the solution: We needed to rename the config xml file to "com.adobe.granite.cors.impl.CORSPolicyImpl-IDENTIFIER.xml".

So we needed to add a Dash between the Factory PID and the IDENTIFIER.

Before we added manually via the Felix Config console the additional config and then we simply packaged up the stored config nodes from the CRX. But this procedure seems not to work for Factory configs.

Actually this is also documented here: Configuring OSGi in a special Note box .

Avatar

Employee Advisor

I tried editing the CORS configuration from /system/console/configMgr. Once i save the changes, noticed the following file getting created under crxde:

/apps/system/config/com.adobe.granite.cors.impl.CORSPolicyImpl-122113ad-1f51-4b73-9c4f-ba1c0d2f1395.config

Have you tried updating the configuration from /system/console/configMgr ?

In another test, I installed the copy-pasted the "com.adobe.granite.cors.impl.CORSPolicyImpl-122113ad-1f51-4b73-9c4f-ba1c0d2f1395.config" and changed the PID and can see the configs under CORS:

So, check the syntax as you should only be changing the PID number (122113ad-1f51-4b73-9c4f-ba1c0d2f1395) for example

Avatar

Level 3

Ahh interesting - because as I did the same procedure as you described, I did not receive a config node name with a Dash in between the Factory PID name and Identifier...

which AEM version did you use?

Avatar

Level 2

@OlivBurHow did you fixed this problem for CORS configuration? We are facing the same issue when we add CORS config to package and deploy it again.