Port and Proxy Config on ng-build

半腔热情 提交于 2019-12-21 12:19:29

问题


I have a frontend running for example on int.myapp.com and it's backend on int.backend.myapp.com. I thought I can do the proxing with the proxy.config.json like this:

 "/api": {
    "target": "https://int.backend.myapp.com",
    "secure": true,
    "changeOrigin": true
  }

And in my package.json file

"start": "ng serve --proxy-config proxy.conf.json"

Everything works on my dev environment.

But when I build for production :

ng buil --prod

and deploy on firebase

firebase deploy

The web application is not able to communicate with the API

How can I do to fix it ?


回答1:


"build": "ng build --prod --proxy-config proxy.conf.json"


来源:https://stackoverflow.com/questions/40995791/port-and-proxy-config-on-ng-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!