Cross-Origin Request Blocked elasticsearch
<p>hi am running Elasticsearch version 2.3 and i have an Angular code to query like a search.when i run it i am getting this error even with http.cors.enabled set to true and also with http.cors.allow-origin to <code>/https?:\/\/localhost(:[0-9]+)?/</code></p>

<pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:9200/elastic/_search?size=50. This can be fixed by moving the resource to the same domain or enabling CORS
</code></pre>

<p>i don't understand what the problem is.</p>

<p>my request headers.</p>

<pre><code>    User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0
Pragma: no-cache
Origin: http://127.0.0.1:8100
Host:   localhost:9200
Connection: keep-alive
Cache-Control:  no-cache
Access-Control-Request-Method:  POST
Access-Control-Request-Headers: content-type
Accept-Language:    en-US,en;q=0.5
Accept-Encoding:    gzip, deflate
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
</code></pre>

<p>my console looks like this.
<a href="https://i.stack.imgur.com/o5jhG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/o5jhG.png" alt="enter image description here"></a></p>

<p>but if i put the request directly in the browser like this..i get correct output.</p>

<p><a href="https://i.stack.imgur.com/uCR6v.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uCR6v.png" alt="enter image description here"></a></p>