node. js 요청 HTTPS 오류: UNABLETO_VERIFY_LEAF_SIGNATURE \ 의 해결 방법
최근 Nodejs 로 https 요청 을 보 낼 때
\”Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE\”
오류 가 발생 했 습 니 다. 오 류 는 다음 과 같 습 니 다.
events.js:72
throw er; // Unhandled \'error\' event
^
Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
at SecurePair. (tls.js:1381:32)
at SecurePair.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:980:10)
at CleartextStream.read [as _read] (tls.js:472:13)
at CleartextStream.Readable.read (_stream_readable.js:341:10)
at EncryptedStream.write [as _write] (tls.js:369:25)
at doWrite (_stream_writable.js:226:10)
at writeOrBuffer (_stream_writable.js:216:5)
at EncryptedStream.Writable.write (_stream_writable.js:183:11)
at write (_stream_readable.js:602:24)
잘못된 이 유 는 상대방 의 디지털 인증서 설정 이 올 바 르 지 않 기 때 문 입 니 다.
해결 방법: reject Unauthorized 인 자 를 false 로 설정 합 니 다.
var https = require(\'https\');
var options = {
hostname: \'www.magentonotes.com\',
port: 443,
path: \'/\',
method: \'GET\',
rejectUnauthorized:false
};
var req = https.request(options, function(res) {
console.log(\"statusCode: \", res.statusCode);
console.log(\"headers: \", res.headers);
res.on(\'data\', function(d) {
process.stdout.write(d);
});
});
req.end();
req.on(\'error\', function(e) {
console.error(e);
});
참고 자료:https://nodejs.org/api/https.html
총결산
이상 은 node. js 가 HTTPS 에 잘못된 해결 방법 을 요청 하 는 것 입 니 다. 본 논문 의 내용 이 여러분 의 학습 이나 업무 에 어느 정도 도움 이 되 기 를 바 랍 니 다. 궁금 한 점 이 있 으 면 댓 글 을 남 겨 주 십시오.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.