:9528/#/students/index:1 Access to XMLHttpRequest at 'http://localhost:8080/javaWeb_war_exploded/getAllStudents.action' from origin 'http://localhost:9528' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. index.vue?6ced:44 Error: Network Error at createError (webpack-internal:///./node_modules/axios/lib/core/createError.js:16) at XMLHttpRequest.handleError (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:69) :8080/javaWeb_war_exploded/getAllStudents.action:1 Failed to load resource: net::ERR_FAILED
时间: 2023-07-11 10:53:43 浏览: 253
FileUpLoadAndDownLoad.zip_JavaScript/JQuery_Java_
这是一个跨域请求的错误,由于浏览器的安全策略,不同域名之间的请求是被禁止的。要解决这个问题,需要在服务器端设置CORS(跨域资源共享)策略,允许请求的来源。如果你是使用Java Web开发,可以在响应头中添加Access-Control-Allow-Origin字段,将其值设置为请求的源头。例如,如果你的请求源头是http://localhost:9528,响应头应该包含:Access-Control-Allow-Origin: http://localhost:9528。这样浏览器就会允许跨域请求了。
阅读全文