I have a Nginx server with an SSL connection. I also have ElasticSearch installed locally. A basic cURL command and I can ping ElasticSearch. However, my Django application which runs on this Nginx server it can't communicate with ElasticSearch using Ajax.
const QUERY_URL = "http://localhost:9200/topics/_search?q=name:" + QUERY
+ "*&sort=follower_count:desc&size=5";
$.ajax({
type: 'GET',
url: QUERY_URL,
success: function (data) {
console.log(data);
},
error: function (xhr) {
if (xhr.status === 0) {
showSnackBarMessage("Can't communicate with server");
}
}
});
I always get this error: net::ERR_BLOCKED_BY_CLIENT. I tried changing GET to POST. I also tried enabling cors in the elasticsearch.yml. However, nothing seems to be working. I'm thinking maybe it's because of my SSL connection that's why I'm unable to connect, but i'm not sure.