<p dir="auto"><strong>Elasticsearch version</strong>:<br>
2.3<br>
<strong>JVM version</strong>:<br>
1.8.0<br>
<strong>OS version</strong>:<br>
Windows 7<br>
<strong>Description of the problem including expected versus actual behavior</strong>:<br>
I have set cors conf in elasticsearch.yml like this<br>
<code class="notranslate">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</code></p>
<p dir="auto">When requesting elasticsearch from file:///C:/elastic/index.html i got the following error<br>
<code class="notranslate">Request header field Content-Type is not allowed by Access-Control-Allow-Headers</code></p>
<p dir="auto">I switched to 2.2 version and i set the same parameters and it works like a charm</p>
<p dir="auto"><strong>Steps to reproduce</strong>:<br>
1.Set cors parameters in elasticsearch.yml<br>
2.Request elasticsearch from an url like this: file:///c:/..</p>
<p dir="auto"><strong>Elasticsearch version</strong>: 2.3.0<br>
<strong>JVM version</strong>: 1.8.0_31<br>
<strong>OS version</strong>: MAC OS X 10.10.5<br>
<strong>Description of the problem including expected versus actual behavior</strong>:<br>
Definition of an accepted a custom header does not seem to work.</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li>Add the following lines to the configuration file</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="http.cors.enabled: true
http.cors.allow-origin: &quot;*&quot;
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: &quot;X-Requested-With, Content-Type, Content-Length, X-User&quot;"><pre class="notranslate"><code class="notranslate">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, Content-Type, Content-Length, X-User"
</code></pre></div>
<ol dir="auto">
<li>Ran an ajax POST request with X-User header.</li>
<li>Getting response "Request header field x-user is not allowed by Access-Control-Allow-Headers in preflight response."</li>
</ol>