Sling model exporter + ReactJS - CORS error

Avatar

Avatar

aliaksandr_hvoz

Avatar

aliaksandr_hvoz

aliaksandr_hvoz

04-04-2020

Hello.

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

aliaksandr_hvoz_0-1586061483205.png

 

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

ReactJS app:

aliaksandr_hvoz_1-1586036150777.png

aliaksandr_hvoz_0-1586061233842.png

 

 

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

aliaksandr_hvoz_3-1586036270269.png

aliaksandr_hvoz_1-1586061305291.png

 

 

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

 

And configuration from AEM:

aliaksandr_hvoz_5-1586036493658.png

I use AEM 6.4 version. 

Could you please tell how to solve this problem.

 

Thanks in advance for any advice.

 

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

BrianKasingli

MVP

Avatar

BrianKasingli

MVP

BrianKasingli
MVP

06-04-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

Answers (1)

Answers (1)

Avatar

Avatar

Suraj_Kamdi

MVP

Avatar

Suraj_Kamdi

MVP

Suraj_Kamdi
MVP

06-04-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.