Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ajax

cors

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

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

Everything works fine in Firefox.

Can anyone help me to resolve this issue?

like image 266
Vinay Verma Avatar asked Feb 17 '11 10:02

Vinay Verma


People also ask

What is the Allow header?

The allow-header entry specifies which headers are presented in preflight responses to clients as acceptable to use when making cross-origin requests to resources which this policy is applicable to.

Are CORS headers case sensitive?

No, the header is not case-sensitive.


1 Answers

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" 
like image 195
Giulio Roggero Avatar answered Sep 20 '22 03:09

Giulio Roggero