[Causes of cross-domain problems] Access to XMLHttpRequest at'http://localhost:

错误:` Access to XMLHttpRequest at ‘http://localhost:3000/framework/create’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.`

1. If you use nginx, check whether the nginx configuration file configures the request port path of the backend

 

 

2. Check whether the backend controller layer has @CrossOrigin annotation

 

3. Check whether the request method of the front end is consistent with that of the back end, and check whether the path is consistent

The backend is post

 

All of the above will lead to cross domain issues

If all the functions of the project cannot be used or all the functions of some modules cannot be used, there is a high probability that it is a problem with nginx.

If only one function in the module reports a cross-domain problem, it is likely to be caused by inconsistent request methods and paths.

Guess you like

Origin blog.csdn.net/xzxailh/article/details/127338106