Expand my Community achievements bar.

SOLVED

Sling model exporter + ReactJS - CORS error

Avatar

Level 3

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.

 

 

 
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

@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

Avatar

Level 2

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