# CORS request did not succeed

**URL:** <https://discuss.elastic.co/t/cors-request-did-not-succeed/222239>\
**Category:** Elasticsearch\
**Created:** [March 5, 2020, 9:05am UTC](https://discuss.elastic.co/t/cors-request-did-not-succeed/222239 "2020-03-05T09:05:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammad\_Ariful\_Isla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/muhammad_ariful_isla/32/55732_2.png) [@Muhammad\_Ariful\_Isla](https://discuss.elastic.co/u/Muhammad_Ariful_Isla)\
**Post date:** [March 5, 2020, 9:05am UTC](https://discuss.elastic.co/t/cors-request-did-not-succeed/222239/1 "2020-03-05T09:05:16Z")

</div>

At first, I tried to access Elasticsearch via a React Application. I was successful at first. But when I try the same app from another machine, Application doesn't show any data.

I am getting this following error at the console,

```auto
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://x.x.x.x:9200/_cat/indices?format=json. (Reason: CORS request did not succeed).

```

Following are the details of relevant configurations,

`elasticsearch.yml`

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

```

Following is the `curl` output,

```auto
curl -k -i -X OPTIONS -H "User-Agent: Mozilla" -H "Origin: http://loggie.netlify.com" -u elastic https://x.x.x.x:9200/_data
Enter host password for user 'elastic':
HTTP/1.1 200 OK
Allow: GET,DELETE,PUT,HEAD
content-type: text/plain; charset=UTF-8
content-length: 0
access-control-allow-origin: *
access-control-allow-credentials: true

```

Can't find where is the problem and where to start the troubleshooting.

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [March 5, 2020, 9:16am UTC](https://discuss.elastic.co/t/cors-request-did-not-succeed/222239/2 "2020-03-05T09:16:29Z")

</div>

Hi,

Which browser are you on? Most (if not all) browsers have a development console where you can see the traffic live. E.g. for Chrome: [https://developers.google.com/web/tools/chrome-devtools/network](https://developers.google.com/web/tools/chrome-devtools/network)

So I propose to your REACT application, open the network tab of the dev tools and start whatever you have to start to make the CORS request. Then you can check both request and response and compare it against the working Curl output.

Best regards  
Wolfram

---

<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:** [April 2, 2020, 9:16am UTC](https://discuss.elastic.co/t/cors-request-did-not-succeed/222239/3 "2020-04-02T09:16:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
