# Calling elastic-search url from react using axios

**URL:** <https://discuss.elastic.co/t/calling-elastic-search-url-from-react-using-axios/102680>\
**Category:** Elasticsearch\
**Created:** [October 4, 2017, 10:28am UTC](https://discuss.elastic.co/t/calling-elastic-search-url-from-react-using-axios/102680 "2017-10-04T10:28:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamza\_moummid](https://avatars.discourse-cdn.com/v4/letter/h/8797f3/32.png) [@hamza\_moummid](https://discuss.elastic.co/u/hamza_moummid)\
**Post date:** [October 4, 2017, 10:28am UTC](https://discuss.elastic.co/t/calling-elastic-search-url-from-react-using-axios/102680/1 "2017-10-04T10:28:33Z")

</div>

I have an Elasticsearch Node running and I can successfully recieve a Json response from the url: localhost:8882/rest/search/all using chrome.

However when I call it from react like this:

var config = {  
headers: {'Access-Control-Allow-Origin': '\*',  
'Accept': 'application/json',  
'Content-Type': 'application/json',  
}  
};  
axios.get('[http://localhost:8882/rest/search/all](http://localhost:8882/rest/search/all)',config).then(function (response) {...  
I get a 403 error Failed to load localhost:8882/rest/search/all; Response to preflight request doesn't pass access control check : No 'Access-Control-Allow-Origin' header is present on the requested resource

---

<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:** [November 1, 2017, 10:29am UTC](https://discuss.elastic.co/t/calling-elastic-search-url-from-react-using-axios/102680/2 "2017-11-01T10:29:01Z")

</div>

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