# Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response

**URL:** <https://discuss.elastic.co/t/request-header-field-content-type-is-not-allowed-by-access-control-allow-headers-in-preflight-response/52566>\
**Category:** Elasticsearch\
**Created:** [June 13, 2016, 5:58am UTC](https://discuss.elastic.co/t/request-header-field-content-type-is-not-allowed-by-access-control-allow-headers-in-preflight-response/52566 "2016-06-13T05:58:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adnan\_Nuruddin](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Adnan\_Nuruddin](https://discuss.elastic.co/u/Adnan_Nuruddin)\
**Post date:** [June 13, 2016, 5:58am UTC](https://discuss.elastic.co/t/request-header-field-content-type-is-not-allowed-by-access-control-allow-headers-in-preflight-response/52566/1 "2016-06-13T05:58:40Z")

</div>

I have a Elasticsearch cluster running on Centos 6 with Java. Whenever I am trying to run a query from my client side made with AngularJs I get the following error,

`Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response`

I have put the following code in my config/elasticsearch.yml file.

```
http.cors.enabled : true
http.cors.allow-origin : "*"
http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type, Content-Length
http.cors.allow-credentials : true

```

What am I doing wrong? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 14, 2016, 3:42am UTC](https://discuss.elastic.co/t/request-header-field-content-type-is-not-allowed-by-access-control-allow-headers-in-preflight-response/52566/2 "2016-06-14T03:42:46Z")

</div>

What version are you on?

---

<div class="post-metadata">

**Author:** ![Adnan\_Nuruddin](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Adnan\_Nuruddin](https://discuss.elastic.co/u/Adnan_Nuruddin)\
**Post date:** [July 11, 2016, 9:45am UTC](https://discuss.elastic.co/t/request-header-field-content-type-is-not-allowed-by-access-control-allow-headers-in-preflight-response/52566/3 "2016-07-11T09:45:19Z")

</div>

`{ "name": "Isaac Christians", "cluster_name": "elasticsearch", "version": { "number": "2.3.1", "build_hash": "bd980929010aef404e7cb0843e61d0665269fc39", "build_timestamp": "2016-04-04T12:25:05Z", "build_snapshot": false, "lucene_version": "5.5.0" }, "tagline": "You Know, for Search" }`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:36pm UTC](https://discuss.elastic.co/t/request-header-field-content-type-is-not-allowed-by-access-control-allow-headers-in-preflight-response/52566/4 "2017-07-05T22:36:38Z")

</div>


