Expand my Community achievements bar.

SOLVED

CORS Error

Avatar

Level 6

Hello Team,

 

We have added one JSON file in our dam at below path:

/content/dam/mysite/file.json which is holding some JSON content.

so when we call it from our endsite domain i.e. https://mysite.com/content/dam/mysite/file.json, It give me response.

 

Requirement:

There is other application hosted using Other Domain.

e.g. https://otherdomain.com , from this domain, they are trying to make call to this url "https://mysite.com/content/dam/mysite/file.json," and they get CORS error in Network. Something as below:

How can we solve this problem? something at dispatcher level, we need to? because in CORS cofiguration in AEM publish, we have allowed domain as "*"

arvind_0-1684750447154.png

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Correct answer by
Community Advisor

Hello @arvind 

 

Please validate the clientheaders section as per below document:

https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/security/develop-for-cro... 

 

For troubleshooting CORS, please refer to Understand Cross-Origin Resource Sharing (CORS) with AEM | Adobe Experience Manager

 


Aanchal Sikka

Avatar

Level 6

Hi @aanchal-sikka  @Vijay_Katoch   

 

Thanks for your kind reply.

 

I added below line in virtual host and It fixed the issue:

 

SetEnvIf Origin "https://otherdomain.com" cors
Header set Access-Control-Allow-Origin " https://otherdomain.com" env=cors