티스토리 뷰

study/Network

로컬 환경의 cross-origin

kwakjun0 kwakjun0 2020. 5. 3. 16:43

로컬 환경에서 API 테스트를 할 경우, CORS 정책에 따른 오류가 발생된다.

(index):1 Access to XMLHttpRequest at 'http://192.168.100.11:8080/idcm-database-1.0.0/selectHistoryInfo' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
192.168.100.11:8080/idcm-database-1.0.0/selectHistoryInfo:1 Failed to load resource: net::ERR_FAILED

 

크롬 브라우저의 경우 cross-origin을 회피하기 위해 크롬확장프로그램을 이용하여 처리 가능하다.

crome cross-origin

https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf

 

Allow CORS: Access-Control-Allow-Origin

Easily add (Access-Control-Allow-Origin: *) rule to the response header.

chrome.google.com

 

댓글
댓글쓰기 폼