Elasticsearch-angular.js authentication issue


I am re-posting this here as there might be lot of UI developers here.

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

The ES plugin you're using doesn't respond properly to the OPTIONS request. See http://stackoverflow.com/a/15734032/414355.

Thanks @magnusbaeck it helped me to resolve the issue..