如何在proxy.conf.json或proxy.conf.js中dynamic定义端口

我有angular4应用程序,并为开发的目的,我开始与npm run startstart定义为"start": "ng serve --proxy=proxy.conf.json" 。 我也有

 { "/api/**": { "target": "http://localhost:8080/api/" } } 

proxy.conf.json定义。 有没有办法,dynamic地定义端口或整个url。 像npm run start --port=8099

PS

http://localhost:8080/api/是我的后端API的URL。

.angular.cli.json

 .... "defaults": { "serve": { "port": 9000 } } .... 

使端口9000上的代理可用,而不是默认的4200。