3

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 Answer 1

2

Fixed with this config:

{
  "/api": {
    "target":  "https://my-domain",
    "secure": false,
    "logLevel": "debug",
    "pathRewrite": {
      "^/api": "/env/api"
    }
  },
  "changeOrigin": true
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.