Response to preflight request doesn't pass access control check: It does not


看下报错截图:

 

 做项目时候发现,有个传输给后端sql语句的的接口有时候可以,有时候会报错,原因是因为,我们用的是post,sql是拼接在url上面(个人认为放在body里面会好点,但是接口时拼接url上,将就下),当传输带有特殊符号时候例如 %    [  ]   /  等等,这些没有经过转义,导致出错。

错误重现:

如下图特殊符号:

 

 

 

 解决:

我们只需要在传输时候,使用转义  encodeURI( )   ,这个方法接受有个string参数

 


免责声明!

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



猜您在找 Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' heade 「日常报错」Response to preflight request doesn't pass access control check: It does not have HTTP ok status. Vue前台,跨域请求报错“Response to preflight request doesn't pass access control check” nginx 实现 ajax 跨域请求Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin 跨域报错has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. 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. 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. Origin 'http://localhost:8000' is therefore not allowed a 跨域请求错误: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource 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
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM