Sling model exporter + ReactJS - CORS error | Community
Skip to main content
aliaksandr_hvoz
New Participant
April 4, 2020
Solved

Sling model exporter + ReactJS - CORS error

  • April 4, 2020
  • 3 replies
  • 3520 views

Hello.

Could you give me some advice on how to fix the error:

 

I created a Sling Model with an exporter and I'm trying to get JSON on request from the ReactJS App.

ReactJS app:

 

 

I also created a filter for the set headers for CORS:

 

 

If I make a request from the browser, I will get JSON but not from ReactApp.

 

And configuration from AEM:

I use AEM 6.4 version. 

Could you please tell how to solve this problem.

 

Thanks in advance for any advice.

 

 

 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

@aliaksandr_hvoz 

Have you tried configuring the "Apache Sling Referrer Filter OSGI configuration"?

Documentation here: https://sourcedcode.com/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration

3 replies

New Participant
November 25, 2022

Exactly I am having the same issue. Trying to get from react app it's giving me cors error

BrianKasingli
BrianKasingliAccepted solution
New Participant
April 6, 2020

@aliaksandr_hvoz 

Have you tried configuring the "Apache Sling Referrer Filter OSGI configuration"?

Documentation here: https://sourcedcode.com/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration

Suraj_Kamdi
New Participant
April 6, 2020

@aliaksandr_hvoz  Please go through this link https://blogs.perficient.com/2019/09/17/creating-your-first-custom-aem-component-using-react-part-1/

I hope this will help you to resolve your query.