Request header field Content-Type is not allowed by Access-Control-Allow-Headers跨域

来源:互联网 发布:主要的编程语言有哪些 编辑:程序博客网 时间:2024/05/25 08:15

跨域错误提示:

XMLHttpRequest cannot load http://xxx.com. Request header field Content-Type is not allowed by Access-Control-Allow-Headers.


解决方案:

例如php服务端程序设置头:

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

主要是这三个:


0 0
原创粉丝点击