Trust self-signed certificates — Node JS, Aurelia

♀尐吖头ヾ 提交于 2021-02-10 19:38:19

问题


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)

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.


回答1:


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
    }));


来源:https://stackoverflow.com/questions/48097156/trust-self-signed-certificates-node-js-aurelia

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!