Elastic API returns 401 from browser client (CORS)

I have followed the documentation and enabled CORS on Elastic cluster (hosted in Azure), so edited the elastic YAML via the cloud portal. Shown below.

Calling Elastic APIs from ObservableHQ as the client and getting CORS error response. The client has a "no-cors" setting that I can pass, then I get a 401 Unauthorized. I know I have the correct API key and the API works, since I can make the same exact call from POSTMAN and it succeeds.

Calling Elastic API: GET /my-index/_search

I realize the ObservableHQ client calls are probably very specific to my case. So more of a general question: do you know if there is anything else I should be having to do other than edit elastic.yaml to allow CORS calls?

Following documentation here

Settings in elastic.yaml

Client call in ObservableHQ, Chrome network data

image

THANK YOU for any advice.

Hey @qd-danh :

If you want to use regular expressions (other than *} in CORS settings, I believe you need to use forward slashes at the beginning and end of the regex - something similar to:

/https?:\/\/.*\.static\.observableusercontent\.com/

Please check the documentation for the http.cors.allow-origin setting.