Angular-cli: DEPTH_ZERO_SELF_SIGNED_CERT - when using ng serve --proxy-config proxy.conf.json

Created on 5 Oct 2016  路  4Comments  路  Source: angular/angular-cli

proxy.conf option for secure = false is not working to ignore the self signed certificate

Mac OSX El Capitan

Versions.

angular-cli: 1.0.0-beta.15
node: 4.4.5
os: darwin x64

Repro steps.

api is running at https://localhost:8443/api with self signed certificate

proxy.conf.json

{
  "/api": {
    "target": "https://localhost:8443/",
    "secure": "false"
  }
}

run ng serve --proxy-config proxy.conf.json
make a request to http://localhost:4200/api/_something_

The log given by the failure.

[HPM] Error occurred while trying to proxy request /api/_something_ from localhost:4200 to https://localhost:8443/ (DEPTH_ZERO_SELF_SIGNED_CERT) (https://nodejs.org/api/errors.html#errors_common_system_errors)

investigation

All 4 comments

Same here...
when I try to use:
"secure": false
I don't get any error message but it looks like the cookie is lost somewhere on the way.

I got this same error when using the following as well.

angular-cli: 1.0.0-beta.17
node: 6.5.0
os: darwin x64

But it was pretty easy to solve. Instead of

"secure" : "false"

I used

"secure" : false

and everything worked.

Oh that seems to be the cause for the error. In https://github.com/angular/angular-cli#proxy-to-backend it's listed as a boolean as well.

This thread worked for me, I just wanted to have a definition of a good proxy conf in one place.

The correct values for proxy.conf.json are:

{
  "/api": {
    "target": "https://localhost:8443/",
    "secure": false
  }
}

I tried using ng serve --ssl but that didn't work, either. I kept seeing DEPTH_ZERO_SELF_SIGNED_CERT errors.

The api proxy backend configuration has to have secure set to false. Here's the doc on webpack's site.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sysmat picture sysmat  路  3Comments

hartjo picture hartjo  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

donaldallen picture donaldallen  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments