简体   繁体   中英

Trust self-signed certificates — Node JS, Aurelia

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM