In order to build a local development environment, webpack plus gelp nodejs environment, the purpose is to easily access the interface between local resources and api of test environment.
1. The address bar of the local development environment reads as follows:
So when the program inside sends ajax, it must start with localhost, and there will be a cross-domain situation. How to deal with it?
2: If the address bar accesses the domain name of the test environment, how can it proxy to the local static resources? The changes will take effect immediately.
Since it is local, then CORS directly, if you don’t have permission, you can try nginx Reverse proxy.