한 로컬 호스트 포트에서 다른 로컬 호스트 포트로 요청을 보내려고합니다. 프론트 엔드에서는 angularjs를, 백엔드에서는 노드을 사용하고 있습니다. 이 CORS Node.js를에서 요청을하기 때문에CORS 오류 : 요청 헤더 필드 인증이 프리 플라이트 응답에서 Access-Control-Allow-Headers에 의해 허용되지 않습니다.
, 내가
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
를 사용하고하고 angular.js 서비스 파일에, 나는 내가 무엇입니까
return {
getValues: $resource(endpoint + '/admin/getvalues', null, {
'get': {
method: 'GET',
headers:{'Authorization':'Bearer'+' '+ $localStorage.token}
}
}),
}
을 사용하고 있습니다 다음 오류
요청 헤더 필드 인증은 프리 플라이트 응답에서 Access-Control-Allow-Headers가 허용하지 않습니다.
도와주세요!
은 당신이 서버에서 인증을 넣어해야하고, 파이어 폭스 나던에 '내가이 res.header ('액세스 제어 - 허용 - 헤더 '를 넣어,이 ÁlvaroTouzón @ –
정식 필요 오리진, X-Requested-With, Content-Type, Accept, Authorization '); in server –