How to Deploy Angular app with Proxy Settings

前端 未结 3 2102
春和景丽
春和景丽 2021-02-13 21:49

I have a proxy config file which has API(web service) link to target to make calls to our database. This proxy config is working fine locally using npm start .<

3条回答
  •  鱼传尺愫
    2021-02-13 22:16

    The proxy config file is for the local development web server. The main reason you use it is so you can avoid cross domain requests when developing the Angular app and the api on your local machine without having to allow cross domain requests in the api.

    When you release to production there is no support for the proxy config file. You will be releasing to your production web server.

    If your api is hosted under the same domain then there is no need for proxying requests as they are not cross domain and if the api is on another domain you will need to allow cross domain request in the api.

提交回复
热议问题