信任自签名证书-Node JS,Aurelia [英] Trust self-signed certificates -- Node JS, Aurelia
本文介绍了信任自签名证书-Node JS,Aurelia的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Aurelia,backed正在使用自签名证书,如果证书不受信任,NodeJS将拒绝通过HTTPS转发请求.
Using Aurelia, backed is using self signed certificate and NodeJS refuses to forward requests over HTTPS if the certificate is not trusted.
[HPM] Error occurred while trying to proxy request /rest/open/test/test-por
tal-url=abcdsdf/ui-settings from localhost:9000 to https://localhost:9443
(DEPTH_ZERO_SELF_SIGNED_CERT)
(https://nodejs.org/api/errors.html#errors_common_system_errors)
尝试过process.env ['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;但我收到流程未定义".另外,尝试设置环境变量,但没有成功.
Tried process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0; but I'm getting "process is not defined". Also, tried to set environmental variable but no go.
推荐答案
在配置中间件的同时,browserSync> server> middleware使用 secure:false
属性来解决此问题.
While configuring middleware, browserSync>server>middleware, used secure: false
property to fix this issue.
middleware.push(proxy('/test-portal/rest', {
target: environmentConfig.testApi,
secure: false,
logLevel: 'debug',
changeOrigin: true
}));
这篇关于信任自签名证书-Node JS,Aurelia的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文