Angular CLI Proxy setup

During development, you often end up in the situation where you have your backend API server running at one address (i.e. localhost:8080) while your frontend development server runs on another (i.e. localhost:4200).
First create proxy.config.json file

Then serve your app with proxy option by type this command:
ng serve –proxy-config proxy.config.json


ref: Angular CLI commands reference:


If you work behind a corporate proxy, the regular backend proxy configuration will not work if you try to proxy calls to any URL outside your local network.

In this case, you can configure the backend proxy to redirect calls through your corporate proxy using an agent:

npm install --save-dev https-proxy-agent

Then instead of using a proxy.conf.json file, we create a file called proxy.conf.js with the content



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s