「日常报错」Response to preflight request doesn't pass access control check: It does not have HTTP ok status.


Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

说明

在使用 axios 进行 ajax 请求时,发生跨域错误。后端使用 SpringBoot,已经加上 @CrossOrigin 注解

原因

浏览器的预检请求失败,即 OPTION 请求失败,根据你的后端放行 OPTION 请求即可

解决方案

// Spring Security 中放行 option 请求
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()

其他后端自行查询如何放行 OPTION 请求即可


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 Response to preflight request doesn't pass access control check: It does not ajax post上传数据时,前端出现的跨域权限问题:ccess to XMLHttpRequest at ‘’rom origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok st Vue前台,跨域请求报错“Response to preflight request doesn't pass access control check” Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' heade 跨域报错has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. nginx 实现 ajax 跨域请求Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed a 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. 跨域请求错误: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource 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
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM