我需要在 AngularCLI / Webpack env 中设置一个代理来将请求转发http://localhost:4200/rest
到https://someserver.com/somepath/rest
一方面,端点是 https 而不是 http。
其次,请求 url 可以是http://localhost:4200/rest/foo
or...:4200/rest/bar
并且所有和任何在 '/rest' 之后的路径都需要映射到https://someserver.com/somepath/rest/foo
or...com/somepath/rest/bar
以下 proxy.conf.json 似乎没有正确配置:
"/rest": {
"target": "https://someserver.com",
"changeOrigin": true,
"ws": true,
"pathRewrite": {
"^/rest/": "/somepath/rest/"
},
"secure": false,
"logLevel": "debug"
}
该应用程序开始于
ng serve --proxy-config proxy.conf.json --live-reload --host 0.0.0.0
谢谢!