brookshi / Hitchhiker

a Restful Api test tool
http://www.hitchhiker-api.com
Other
2.19k stars 401 forks source link

自己的SSL证书时,Request出错 #252

Closed lu007heng closed 6 years ago

lu007heng commented 6 years ago

我尝试用hitchhiker测试公司内部的API,这个API使用了自己的SSL证书。https://example.com/test

然后得到了结果: { "message": "unable to verify the first certificate", "stack": "Error: unable to verify the first certificate\n at TLSSocket. (_tls_wrap.js:1088:38)\n at emitNone (events.js:86:13)\n at TLSSocket.emit (events.js:188:7)\n at TLSSocket._finishInit (_tls_wrap.js:610:8)\n at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38)" }

请问有办法可以绕过这个check吗

lu007heng commented 6 years ago

大神微信上提供了在线咨询,可以通过这个方式绕过这个验证:

  1. 进到容器sudo docker exec -it hitchhiker bash
  2. export NODE_TLS_REJECT_UNAUTHORIZED=0
  3. 然后再执行 pm2 restart index
brookshi commented 6 years ago

有这个问题的可以把NODE_TLS_REJECT_UNAUTHORIZED=0做为环境变量加到docker-compose.yml或pm2.json里,方便更新