Angular-CLI proxy to backend doesn't work

后端 未结 9 1103
不知归路
不知归路 2020-11-28 08:00

https://github.com/angular/angular-cli#proxy-to-backend here is an instruction how to do proxying to backend. I did everything step by step and still requests aren\'t proxie

9条回答
  •  再見小時候
    2020-11-28 08:21

    Could you try with this one:

    {
      "/api": {
        "target": "http://url.com",
        "secure": false,
        "pathRewrite": {"^/api" : ""}
      }
    }
    

    It works for me,

    ** NG Live Development Server is running on http://localhost:4200. **
     10% building modules 3/3 modules 0 active[HPM] Proxy created: /api  ->  http://ec2-xx-xx-xx-xx.ap-south-1.compute.amazonaws.com
    [HPM] Proxy rewrite rule created: "^/api" ~> ""
    

提交回复
热议问题