Today I Learned/오류

[Error]Access to XMLHttpRequest at '주소A' from origin '주소B' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

BaGyun 2022. 7. 8. 16:39

어떤 에러인가요?

axios로 서버에 응답을 요청했을 때 CORS 오류

 

에러 메세지

Access to XMLHttpRequest at '주소A' from origin '주소B' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

에러 핸들링 방법

CORS 설정에서 origin의 경로를 정확하게 기입한다.
(https와 http를 제대로 기입하여 해결함.)