0
votes

I need to proxy requests from localhost to HTTPS backend. I use this code from the doc:

{
  "/api": {
    "target":  "https://my-domain",
    "secure": false,
    "logLevel": "debug",
    "pathRewrite": {
      "^/api": "/env/api"
    }
  }
}

But it returns an error:

[HPM] Error occurred while trying to proxy request /env/api/my/url/ from localhost:4200 to https://my-domain (EPROTO) (https://nodejs.org/api/errors.html#errors_common_system_errors)

1

1 Answers

0
votes

Fixed with this config:

{
  "/api": {
    "target":  "https://my-domain",
    "secure": false,
    "logLevel": "debug",
    "pathRewrite": {
      "^/api": "/env/api"
    }
  },
  "changeOrigin": true
}