# CORS issue when accessing REST Javascript API

**URL:** <https://discuss.elastic.co/t/cors-issue-when-accessing-rest-javascript-api/233401>\
**Category:** Elasticsearch\
**Created:** [May 19, 2020, 8:22pm UTC](https://discuss.elastic.co/t/cors-issue-when-accessing-rest-javascript-api/233401 "2020-05-19T20:22:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SriKot](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@SriKot](https://discuss.elastic.co/u/SriKot)\
**Post date:** [May 19, 2020, 8:22pm UTC](https://discuss.elastic.co/t/cors-issue-when-accessing-rest-javascript-api/233401/1 "2020-05-19T20:22:30Z")

</div>

we are trying to access elastic search from a webpage, we are getting this error. i have made changes in apm-server.yml for APM cluster under "User Settings Override" section from elastic console

is there a document which explains yml format to add CORS. appreciate it.

==========  
Access to XMLHttpRequest at '[https://32a7aecefc1c45628475e23728927ba9.us-central1.gcp.cloud.es.io:9243/items/item](https://32a7aecefc1c45628475e23728927ba9.us-central1.gcp.cloud.es.io:9243/items/item)' from origin '[https://mydomainname.com](https://mydomainname.com)' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.  
searchItem @ search.html:63  
(anonymous) @ search.html:78  
dispatch @ jquery.min.js:2  
v.handle @ jquery.min.js:2

---

<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:** [June 16, 2020, 8:22pm UTC](https://discuss.elastic.co/t/cors-issue-when-accessing-rest-javascript-api/233401/2 "2020-06-16T20:22:46Z")

</div>

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