• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How to fetch elasticsearch api with auth

Resolved: How to fetch elasticsearch api with auth

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

i try to fetch elastic api using javascript with basic authentication, but there is error show that request header field authorization is not allowed by acccess-control-allow-headers, is it something wrong with the elasticsearch api or the wrong is on my code? i already setting enable cors on elastic, i tried curl to get elastic data with auth and it works, does the fetch code is wrong?
the console error : enter image description here
the fetch code :

Answer:

To use fetch from your browser, you will have to allow cross-origin requests in the ElasticSearch configuration:
Source:
https://www.elastic.co/guide/en/elasticsearch/reference/8.2/modules-network.html https://www.elastic.co/guide/en/cloud-enterprise/current/ece-configure-cors.html

If you have better answer, please add a comment about this, thank you!

elasticsearch fetch javascript
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Java Virtual Machines deleted

27/03/2023

Resolved: PyCharm cannot see my newly compiled .pyc see on import

27/03/2023

Resolved: I am facing ERR_HTTP2_PROTOCOL_ERROR on my website

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.