수 없습니다 HTTPS를 XMLHttpRequest
요청을 할 것을 요청 -이 돌아 가지 :없음 '액세스 - 제어 - 허용 - 원산지'HTTPS에 대한 헤더
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:8443' is therefore not allowed access.
을 내가 www.google.com
와 함께 URL을 교체하는 경우, 그것은 괜찮지 만 https://www.google.com
똑같은 일을합니다.
Postman/JaSON Chrome 확장 프로그램을 사용할 때 작동하므로 open -a Google\ Chrome --args --disable-web-security
을 시도했지만 작동하지 않았습니다.
let request = new XMLHttpRequest();
request.open("POST", "https://outlook.office365.com/EWS/Exchange.asmx", true);
request.setRequestHeader("Authorization", "Bearer " + asyncResult.value);
request.setRequestHeader("Content-type", "text/xml; charset=utf-8");
request.setRequestHeader('Access-Control-Allow-Origin', '*');
request.setRequestHeader("Access-Control-Allow-Headers", "Content-type, Origin");
request.setRequestHeader("Access-Control-Allow-Methods", "POST");
request.onload = function() {
};
request.onerror = function() {
debugger;
}
request.send(requestBody);
서버가 JavaScript가 아닌 COR을 설정합니다 – epascarello
'outlook.office365.com'이 (가) 귀하의 도메인이 아니라고 추측하고 보안상의 이유로 크로스 기점 아약스를 수행 할 수 없습니다. ** 서버 **가 CORS 헤더) *. – adeneo
@adeneo 네, 지금은'localhost'에서 왔지만 여전히'outlook.office365.com'에게 데이터를 가져 오기 위해 요청을 보내야합니다. – Kristin