在镀铬错误:内容类型不受访问控制 - 允许 - 头允许
问题描述:
我试图发送一个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服务器的虚拟主机配置如下设置
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"