Deaktivieren der SSL-Zertifikatsprüfung in unirest (NodeJS)
English
Deutsch
Problem:
Du möchtest eine HTTP-Anfrage mit unirest machen wie diese:
unirest_example.js
const unirest = require('unirest');
unirest.get("https://mydomain.net").end(console.log)aber du triffst auf folgenden Fehler:
unirest_error.txt
{ error:
{ Error: unable to verify the first certificate
at TLSSocket.<anonymous> (_tls_wrap.js:1088:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:188:7)
at TLSSocket._finishInit (_tls_wrap.js:610:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' } }Lösung
Du kannst dieses Problem umgehen, indem du strictSSL(false) verwendest wie folgt:
unirest_example_strictssl.js
const unirest = require('unirest');
unirest.get("https://mydomain.net")
.strictSSL(false)
.end(console.log)Beachte jedoch, dass dies negative Auswirkungen auf die Sicherheit deiner Anwendung haben kann, da diese Anfrage anfällig für Man-in-the-Middle-Angriffe sein wird.
Check out similar posts by category:
Javascript
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow