내 커뮤니티 업적 표시줄을 확대합니다.

Get ready! An upgraded Experience League Community experience is coming in January.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Cors error react - graphql

Avatar

Level 2

I am unable to consume response from AEM to React application.

React App - AEM Headless Example | Adobe Experience Manager

Access to fetch at 'http://localhost:4504/content/graphql/global/endpoint.json' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 2

I am able to consume response with help of below configuration

 

Adobe Granite CSRF filter - Excluded path 

Add cutom graphql endpoint - for example - /content/_cq_graphql/myproject/endpoint.json

 

 

원본 게시물의 솔루션 보기

3 답변 개

Avatar

Employee Advisor

Hi @sathyaprakash 

Please check below link to configure your CORS policy and Sling Refferer Filter on AEM to enable GraphQL Endpoints accessible to external application

https://www.albinsblog.com/2021/10/how-to-deliver-headless-content-through-graphql-api-and-content-f...

 

Avatar

정확한 답변 작성자:
Level 2

I am able to consume response with help of below configuration

 

Adobe Granite CSRF filter - Excluded path 

Add cutom graphql endpoint - for example - /content/_cq_graphql/myproject/endpoint.json

 

 

Avatar

Employee Advisor

@sathyaprakash @kautuk_sahni 
Can you please mark the correct answer, so people would know the result of this query.