跨域问题总结

90 阅读1分钟

本文已参与「新人创作礼」活动, 一起开启掘金创作之路。 ​

 遇到的跨域问题整理,都是在php文件里面添加的 

附上参考链接

跨域问题服务端解决办法 Request header field Authorization is not allowed by Access-Control-Allow-Headers - WebEnh - 博客园

解决:Request header field Content-Type is not allowed by Access-Control-Allow-Headers - 程序员大本营

1.  

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

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS,PATCH');

 Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. 

header("Access-Control-Allow-Origin: *");

\