
이번에 네이버 영화 API를 통해서 뭐 좀 가져 오려고 하면 여기는 또 그놈의 CORS로 막히는 문제가 생겼다. 그래서 시도해본 게, 1. 우회URL을 사용 : 네이버API에서 자체적으로 막아서 안됨 ( 403 에러 ) 2. 헤더에 Accept : "*" 추가 : 이유는 모르겠으나, CORS에러가 떨어짐.. 그래서 Vue프로젝트 자체에서 프록시를 설정해줄 수 있다고 해서 이번에 정리해본다. 우선 테스트용으로 proxy-project라는 프로젝트를 하나 생성해주었다. ( axios 등 환경도 설치 ) 우선 root경로(package.json이 있는 경로)에 다음 파일을 만들어준다. vue.config.js module.exports={ devServer: { proxy: { // proxyTable 설정 ..

오늘 API를 통해 데이터를 받아오는 것을 공부하고 있는데, CORS에러가 떴다.. 공공데이터포털에서 데이터를 받아오는데, 아래와 같이 URL요청을 하니 에러가 발생했다. methods : { search : function(){ var self = this; var url = apiURL + '?serviceKey=' +apiKey + '&pageNo=' + this.pageNo + '&numOfRows=' + this.numOfRows + '&nrsry_type=' + this.nrsryType; axios.get(url).then(function(result) { // url호출 -> 공공데이터포털로 데이터 요청을 보낸다. (request) self.apiList = result.data.items..