解决has been blocked by CORS policy: No Access-Control-Allow-Origin header is present on the request

前端报错(index):1 Access to XMLHttpRequest at ‘http://localhost:8080/order/getInfo’ from origin ‘http://127.0.0.1:8080’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

今天用127.0.0.1:8080访问页面时,页面正常显示,与后台交互就报跨域的错。然后用localhost:8080就完全正常了

你可能感兴趣的:(工作记录)