Hi folks. I've been having some trouble over in the Cloud Category getting my custom dashboard to talk to my ES cluster, and despite a bunch of help with cors
settings, it still doesn't seem to be working. I may be doing something daft, but can't find out what.
I have a simple static HTML page that calls this bit of js:
define(['js/d3.v3', 'js/elasticsearch'], function (d3, elasticsearch) {
"use strict";
var client = new elasticsearch.Client({
host: 'https://myusername:mypassword@mycluster.eu-west-1.aws.found.io:9243', log: 'trace'});
client.ping({
requestTimeout: 10000
}, function(error){
if (error) {
console.trace('elasticsearch cluster is down!');
console.trace(error);
} else {
console.log('All is well');
}
});
});
And all I get in my Chrome dev tools is a 401 Unauthorized
response.
With the help of @bevacqua I have my elasticsearch.yml settings now as follows:
http.cors.allow-credentials: true
http.cors.enabled: true
http.cors.allow-origin: "http://nagios.communigator.co.uk"
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization"
related questions for reference:
Change to CORS setting seems to have broken Kopf
Using js/elasticsearch with a cluster instance