[Solved] No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.errError: Network Error

Console error message

Access to XMLHttpRequest at 'http://**/login' from origin 'http://**:9528' 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.
errError: Network Error

Cause analysis

According to Access-Control-Allow-Origin, it can be seen that it is a cross domain problem. If one address accesses another address, if any of the three places is different in this process, cross domain problems will occur.

1. Access agreement

HTTP, https

2. The port number is different

My error report here is to use 9528 to access 8001

3. Different IP addresses

Solution:

1. Add a comment on the back-end interface controller @CrossOrigin
2. Use the gateway to solve the problem

Read More: