「日常報錯」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-2026 CODEPRJ.COM