Elasticsearch-angular js authentication issue


(SK) #1

Hi,

I am using elasticsearch-angular.js client to connect to my ES instance which has custom security plugin installed. Below is the code i am using to make connection

myServices.service('es', ['esFactory',
function (esFactory, $http) {
return esFactory({
host: 'http://esadmin:esadmin@localhost:9200',
log: 'trace'
});
}]);

I have enabled cors in ES as below
http.cors:
enabled: true
allow-origin: "/.*/"
allow-credentials: true
allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization"
allow-methods: "OPTIONS, HEAD, GET, POST, PUT, DELETE"

However i get the below errors when inspected in chrome

OPTIONS http://localhost:9200/

XMLHttpRequest cannot load http://localhost:9200/. Response for preflight has invalid HTTP status code 401

Could you please help me out


(Magnus Bäck) #2

Answered in this thread:


(system) #3