Angular-CLI proxy to backend doesn't work

后端 未结 9 1127
不知归路
不知归路 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:29

    I had to make a small adjustment based on the above answers, although it seems a bit odd looking at the config now.

    This is my proxy.conf.json shown below:

    {
      "/api/*": {
         "target": "https://url.com",
         "secure": false,
         "changeOrigin": true,
         "logLevel": "debug",
         "pathRewrite": {"^/api" : "http://url.com/api"}
      }
    }
    

    Basically, I rewrote the path completely. And it works now.

提交回复
热议问题