Mastering Angular proxy configuration

JM Robles
3 min readOct 25, 2020
Is proxy.conf.js weird? No! It’s fun!

TL;DR: How to configure your Angular project to use a backend while your are developing in local mode.

Rarely you have to develop an isolate Angular app. The normal thing is that it has access to a backend and/or consumes one or more APIs.

Then, you starts the development in your local computer and when you write your service for access to the backend or API, and access with your browser to http://localhost:4200...

Surprise! Probably you have a CORS problem… (at least)

WTF can’t access to my backend!

Angular CLI provides a solution to bypass these problems: reverse proxy server.

Enable the Angular Proxy

To use the angular proxy you need to define a configuration file and pass it when invoking.

We use the following proxy.confas base template.

--

--

JM Robles
JM Robles

Written by JM Robles

AIOps @ Montevive.ai / Backend / Platform engineer #llm #rag #llamaindex #langchain #go #python #kubernetes #terraform #devops

No responses yet