ionic 3/node.js-证书链中的自签名证书(如何禁用strict-ssl?)

ionic 3/node.js-证书链中的自签名证书(如何禁用strict-ssl?)

问题描述:

由于以下错误,我无法使用ionic start创建离子项目:

I cannot create a ionic project with ionic start because of following error:

Error: self signed certificate in certificate chain
    at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:637:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38)

在cmd上:ionic start myApp tabs

因为我们的代理会为所有站点发送一个自签名的签名. (FortiNet的FortiGate)

Because our proxy sends a self-signed signature for all sites. (FortiGate of FortiNet)

在npm中,我将strict-ssl设置为false并可以正常工作.但是ionic会通过节点应用程序加载内容,对吧?

In npm I set strict-ssl to false and works fine. But ionic loads the content over a node application, right?

如何设置节点以忽略所有节点应用程序的自签名证书,或者如何针对离子禁用它?

How to setup node to ignore self signed certificates for all node applications or how to disable it for ionic?

ionic info

   @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

System:

    Node : v8.9.1
    npm  : 5.5.1
    OS   : Windows 10

Misc:

    backend : legacy

我使用以下方法解决了我的问题:

I resolved my problem using:

set NODE_TLS_REJECT_UNAUTHORIZED=0