Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Deploy Angular app with Proxy Settings

Tags:

angular

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 .

Now I Need to deploy this app to our production windows server on IIS. I used ng build and ng build --prod looks like this is not generating build with proxy setting. I need help that How I can generate a build with proxy setting so that I can deploy it to prod server.

Api is deployed on some other domain and this angular app will be deployed on some other domain.

Thanks

like image 704
Filmjamr Movies Avatar asked Dec 03 '18 04:12

Filmjamr Movies


1 Answers

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.

like image 123
Adrian Brand Avatar answered Oct 20 '22 20:10

Adrian Brand