Splunk 6.1.5
Writing a test application for using REST API using Client JavaScript I got this error
XMLHttpRequest cannot load https://localhost:8089/services/auth/login?output_mode=json. Request header field X-Splunk-Form-Key is not allowed by Access-Control-Allow-Headers.
The app is:
var http = new splunkjs.JQueryHttp();
var service = new splunkjs.Service(http,{
scheme:"https",
host: "localhost",
port: 8089,
username: "username",
password: "password",
version: "6.1"
});
service.apps().fetch(function(err, apps) {
if (err) {
alert("Error listing apps");
return;
}
var myapps = "";
var appsList = apps.list();
for(var i = 0; i < appsList.length; i++) {
myapps += "App " + i + ": " + appsList[i].name + "<br/>"
}
document.getElementById("applist").innerHTML=myapps;
});
In server.conf i enalbled cross origin
[httpServer]
crossOriginSharingPolicy = *
(If I set crossOriginSharingPolicy = https://localhost:8089 doesn't work)
... View more