# Get an CORS error When requested elastic search rest API

**URL:** <https://discuss.elastic.co/t/get-an-cors-error-when-requested-elastic-search-rest-api/285331>\
**Category:** Elasticsearch\
**Created:** [September 28, 2021, 9:11am UTC](https://discuss.elastic.co/t/get-an-cors-error-when-requested-elastic-search-rest-api/285331 "2021-09-28T09:11:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MB\_KING](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mb_king/32/95168_2.png) [@MB\_KING](https://discuss.elastic.co/u/MB_KING)\
**Post date:** [September 28, 2021, 9:11am UTC](https://discuss.elastic.co/t/get-an-cors-error-when-requested-elastic-search-rest-api/285331/1 "2021-09-28T09:11:21Z")

</div>

hi  
Im working on React Project and using Axios package for requested Elasticsearch rest API . after call I receive CORS error  
how can fix this error and get data ?  
error :

```auto
Access to XMLHttpRequest at '<self server elastic search Url >' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

```

Thanks for all the help  
sorry for

---

<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:** [September 28, 2021, 9:41am UTC](https://discuss.elastic.co/t/get-an-cors-error-when-requested-elastic-search-rest-api/285331/2 "2021-09-28T09:41:08Z")

</div>

Elasticsearch doesn't run on port 3000, so it's possible that there's a proxy in use there.

---

<div class="post-metadata">

**Author:** ![MB\_KING](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mb_king/32/95168_2.png) [@MB\_KING](https://discuss.elastic.co/u/MB_KING)\
**Post date:** [September 28, 2021, 1:11pm UTC](https://discuss.elastic.co/t/get-an-cors-error-when-requested-elastic-search-rest-api/285331/3 "2021-09-28T13:11:37Z")

</div>

tnx for awnser . Elasticsearch run on 9200 port .  
[http://localhost:3000](http://localhost:3000) is related to react local server

---

<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:** [October 26, 2021, 1:12pm UTC](https://discuss.elastic.co/t/get-an-cors-error-when-requested-elastic-search-rest-api/285331/4 "2021-10-26T13:12:04Z")

</div>

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