Calling elastic-search url from react using axios

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',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

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