错误:Access-Control-Allow-Header不允许使用Content-Type [英] Error: Content-Type is not allowed by Access-Control-Allow-Headers

查看:305
本文介绍了错误:Access-Control-Allow-Header不允许使用Content-Type的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试发送Ajax请求时在Chrome中收到此错误:

I am getting this error in Chrome when trying to send an ajax request:

Content-Type is not allowed by Access-Control-Allow-Headers

一切在Firefox中都可以正常运行.

Everything works fine in Firefox.

有人可以帮助我解决此问题吗?

Can anyone help me to resolve this issue?

推荐答案

我解决了将以下设置添加到Apache Web Server虚拟主机配置的问题

I solved the problem adding to Apache Web Server virtual host configuration the following settings

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"

这篇关于错误:Access-Control-Allow-Header不允许使用Content-Type的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆