The solution to the Cross-domain problem of different Ports in Angular

recently started to learn, is still in the tutorial stage, there is a ready-made background to test, but found a problem, angular before and after the project separation mode, will inevitably encounter different port cross-domain problem, why there is no solution in the official tutorial.
in my case, the port of the front segment of Angular is 4200, and the running port of my background project is 8080. How to connect to the background to request data across domains, thank you!


set reverse proxy. Just write a configuration file in the project


Baidu angular proxy will have many detailed steps

Menu