跨域请求报错 No Access-Control-Allow-Origin header is present on the requested resource.

跨域请求,浏览器提示

Access to XMLHttpRequest at 'xxx1' from origin 'xxx2 has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

解决方法为:

添加header

Access-Control-Allow-Origin:
*